Astronomers think that spiral galaxies are slowly built over time through the merger of smaller galaxies. As these tiny galaxies came together, their total momentum set the merged galaxy spinning. This spin flattened out the galaxy and set the spiral arms in motion.