Usually done with help of autosampler.
Nitrogen gas is bubbled into a tube containing sample to draw out the volatile parts of the mixture.
Mixture is held in a trap until GC signals the computer to start the oven program.
Mixture is injected into the inlet of both the GC and MS at the same time. Both instruments collect data at the same time.
As the compound is sent through and out of the column, the MS shatters each compound into ions as they are ejected and quantifies their mass spectra.
At the end of the column, there is a flame ionizing detector, FID, which combusts the sample with the aid of hydrogen gas.