The Whirlpool Galaxy is actually two galaxies having gravitational interaction between them. At the time of its discovery the difference between galaxies and nebulae was not yet known, all diffuse objects apart from comets were called nebulae.
Discovery
Charles Messier discovered the brighter galaxy of the pair in 1773 while he was observing a comet, he entered the object as the 51th in his famous catalogue. The difference between various diffuse looking deep-sky object types was not yet known at those times, the objects were classified based on their visual appearance. Messier described the galaxy as very faint nebula without stars. The smaller galaxy was discovered by a friend of Messier, Pierre Méchain, who entered the following handwritten note next to the description of Messier 51 in his personal copy of the Messier Catalogue: 'It is double, each has a bright center, which are separated 4'35". The two "atmospheres" touch each other, the one is even fainter than the other.'
A pair of galaxies
Since then it was realized they are two extra-galaxies with gravitational interaction between them. The bigger one is identified as NGC 5194, while the smaller one is NGC 5195. The bigger galaxy has justified the name 'Whirlpool Galaxy' by its spectacular spiral arms. It is classified as grand-design spiral galaxy, its de Vaucouleurs classification is SA(s)bc pec. The 'pec' is standing for peculiar, indicating the distortion caused by the interaction with the other galaxy. NGC 5194 has an active galactic nucleus (AGN) with a super massive black hole in the centre specific to Seyfert 2 type of galaxies. Dust rings can often be observed around black holes in galactic centres, just like in the case of NGC 5194. Interestingly there is a second dust ring intersecting the primary one which is against the expectations.
The smaller galaxy, NGC 5195 is a quite distorted dwarf galaxy, there are many different opinions regarding its morphological classification: it is identified as amorphous, lenticular and even irregular galaxy. Actually the standard morphological classification systems can't really handle it well.
This pair of galaxies got the attention of Halton Arp as well. Arp tried to collect the peculiar galaxies, including the interacting galaxies. That's why Messier 51 got in his Catalogue of Peculiar Galaxies as a prominent example of spiral galaxy having a satellite.
According to our current knowledge the small satellite galaxy crossed the main plane of NGC 5194 twice so far. First 5-600 million years ago when the small galaxy came behind the bigger one and got in front of it, and second 5-10 million years ago when it got behind again. These two events and the constant gravitational interaction highly contributed to evolving prominent spiral arms in the bigger galaxy. There is also a tidal bridge rich in dust between the galaxies, which can be easily observed as dust clouds in front of the satellite galaxy.
The distance of the galaxies was determined more accurately in 2005 using the light curve of supernova SN 2005cs. According to the calculations the distance of the galaxies is about 23 million light years. At that distance the 11.2" apparent size of the galaxy means 86000 light years in diameter, which is smaller then the size of the Milky Way.
The Messier 51 group
The Whirlpool Galaxy is the largest one in the galaxy group named after it. The group's other members are: Messier 63, NGC 5023 and NGC 5229.