There are two different ways of determining the chemical composition of a material. One is by looking at light – characteristic light – that is emitted from materials. Or you can measure the atoms by mass, and therefore discriminate the different elements. And to do this you need a mass spectrometer. A spectrometer measures the number of atoms by means of an electrical counting system, and that's where the "meter" part of the spectrometer comes.
Mass spectrometers come in different varieties. Some use magnets to separate ions, and others might use electrical acceleration. The magnetic sector mass spectrometers use a bending magnet: When the ions or atoms enter the magnet, they are forced to bend, and the light ions bend sharper than the heavy ions, as a result of which they're separated into a spectrum, like a rainbow. You get a rainbow of masses, where light masses are on one end, and heavy masses are on the other end.
Explore them more for yourself with this interactive tutorial.