The arms are not solid structures rotating with the galaxy — they are density waves, regions where the implosive tendency of gravity temporarily concentrates matter as it passes through. Stars drift in and out of the arms over millions of years, but the wave pattern persists, continuously triggering new rounds of implosion and redistribution as fresh gas clouds get compressed by the density wave passing through them.