
Before the 1920s, astronomers debated whether 'nebulae' were separate galaxies. In 1923, Edwin Hubble, observing Cepheids in Andromeda, proved that it was another galaxy. Hubble also created a classification of galaxies by shape.
Stars in a galaxy orbit around a common center of mass, following the law of universal gravitation. Spiral arms are density waves where gas compresses and new stars are born, like a traffic jam: stars move through the arms, but in the jam zone their density is higher.