The spiral arms are actually density waves that move around the disk of the spiral galaxy. As the density wave passes over a region, masses are pulled together, and you get bright pockets of star formation. Then the density wave moves on, and encourages another region to begin star formation.