Q&A: General Astronomy and Space Science
What do the initials of "OBAFGKM" mean?
It appears that when stars were first being classified in the 1890s, an astronomer at Harvard named Edward Pickering decided to sort the stars according to how much hydrogen they contained. The ones with the most hydrogen were called A stars, those with a bit less were labeled B stars, and on down the alphabet for a total of 22 classes.
Another Harvard astronomer, Annie Jump Cannon, realized from her observations that the stars could be classified by their temperatures instead, so she ordered the stars from hottest to coldest. The stars labeled "O" in the previous classification turned out to be the hottest stars, and "B" stars were the second hottest, on down to "M." As a scientist, she knew that it is more useful to classify objects by temperature (which explains why a particular quantity of hydrogen is observed) rather than simply the amount of hydrogen present.
More detail on the OBAFGKM story:
Description of the spectral types (the labels OBAFGKM are called "spectral types" because the way to measure hydrogen in stars is to look at their spectra, or emission lines):