The magnitude scale began in 129 B.C., when the ancient Greek astronomer Hipparchus classified the stars. He called the brightest stars "first magnitude," meaning "the brightest." He had six rankings in his classification system, meaning the faintest stars he could see were "sixth magnitude."
When Italian scientist Galileo Galilei turned his telescope to the sky, he discovered stars fainter than the faintest stars visible to the naked eye. Since these stars were fainter than Hipparchus's faintest stars, Galileo called them "seventh magnitude." And so as astronomers with larger telescopes discovered fainter and fainter stars, they kept classifying them into higher and higher magnitude categories.
In the 1800s, astronomers had tried to classify so many stars that the magnitude system confused them. They realized they needed to give the magnitude system a mathematical definition, so that two astronomers could agree on exactly how bright a star was. In 1856, Oxford astronomer Norman Pogson suggested that a star's magnitude should be defined in terms of the star's radiant flux.
In Hipparchus's ancient system, first magnitude stars emitted about 100 times as much light as sixth magnitude stars. So Pogson defined his scale such that an increase of five magnitude numbers meant a 100-fold increase in radiant flux. By this definition, Vega's magnitude fell very close to zero, so astronomers chose Vega as the reference point for the magnitude system. Later, astronomers extended the magnitude scale to brighter objects by giving them negative numbers. Today, the magnitude system has been extended so far that there are now 56 magnitudes between the brightest thing we can see (the Sun, -26) and the faintest (faint objects in Hubble Space Telescope images, +30). In terms of amount of light received on Earth, the magnitude scale spans a factor of 2.5156, or two thousand billion billion!
The magnitude scale seems arbitrary and confusing, even to astronomers. But the scale gives a precise measurement of the brightnesses of stars, and pays tribute to the 4000-year history of astronomy as a science, so astronomers keep using it.