If you look in the constellation of Andromeda on a dark night, you can see a small faint smudge that looks a bit like a smudge of chalk against the starry blackness. The image below gives a good idea of its appearance to the naked eye. This object is known as M-31, named after Charles Messier who first cataloged these fuzzy objects in the 1770s.
In the 1700s, it was clear that the Messier objects such as M-31 are not stars. They are also not comets, as they they don’t move through the sky. Messier actually cataloged these objects so he wouldn’t confuse them with comets, which also look like fuzzy patches in the sky.
At the time M-31, was known as a nebula. The known universe then was thought to be similar in structure to what we now call the Milky Way galaxy, so Messier objects were thought to be regions of gas and dust. Some Messier objects are just that, but in the mid-1800s it was noticed that M-31 had a light spectrum that looked more like a collection of stars than a nebula. By the late 1800s, photographic observations confirmed that M-31 was a cluster of stars, not gas and dust.
In 1925 Edwin Hubble took careful measurements of variable stars in M-31 known as Cepheid variables. These stars vary in brightness at a rate proportional to their absolute magnitude. By measuring the changes in their brightness, Hubble determined their distance. What he found was that M-31 was about 2 million light years away, and not part of our own galaxy. Hubble demonstrated that the universe contained island galaxies in a vast empty space, and our galaxy was just one among many.
M-31 is now more commonly known as the Andromeda galaxy. At 2.5 million light years away, it is the most distant object that can be easily observed with the naked eye. The Triangulum galaxy (M-33) is a bit more distant, but fainter. So if you get a chance to glimpse the Andromeda galaxy some night, you’ll know you’re looking at island of stars in the cosmos.