To distinguish them from stars, they were called nebulae. However, there are other extra-solar objects which are also extended, like Planetary Nebulae, star clusters, and super nova (SN for short, and SNe for the plural) remnants, for example. Since before the 1920s we didn't know the distance to those objects, it wasn't clear what was the difference between all these types. And so many of the catalogues of nebulae, like Messier's catalogue (objects denoted by an `M' , like M31, which is Andromeda), or NGC (New General Catalogue, Dreyer 1888), contain a baffling variety of different types of objects.
Immanual Kant, the German philosopher, already figured out that we see the faint band of stars across the night sky - usually called the Milky Way (MW for short) - because on a larger scale most stars around us are distributed in a disk, and the sun is located in that disk. And so, when you look out at night in the plane of the disk, you see a faint band of light, which Galileo already had resolved into stars! And most of these other nebulae you see, were just other galaxies. Though this was a correct hypothesis, it took until the 1920s before the matter was settled. The historical introduction in BM is well worth reading.
As a final point: why do we study galaxies? Are they in some sense the most important building blocks in the Universe? I like BMs reasoning: stars are apparently huddled together in galaxies. And since (not surprisingly if you think about it) we (humans) can see stars, we are naturally inclined to study them. But, for example, although a cluster of galaxies contains thousands of galaxies, they are by no means the main constituent. Most of the mass is in dark matter - which we cannot see at all. But most of the baryons is in hot gas, which we can observe with X-ray satellites, but we cannot see. And so the choice to study galaxies is a bit human centred: our eyes can see them.