Figure: Theory of Spiral Arm Formation

The formation of the spiral patterns is still somewhat of a mystery because a simple model of differential rotation (rotational speed varies with distance) would produce tightly wound spirals (within 500 million years) in contrary to observation. A generally accepted mechanism for producing the spiral structure involves wave of excess density (density wave) that gently travels around the galaxy compressing gas in its wake. This compressed gas triggers star formation and helps to explain why we see the concentration of bright young stars and clusters in the spiral arms. The figure is a schematic model illustrating the action of a density wave, which causes stars and interstellar gas and dust to bunch up temporarily, with the spiral arm being the result of a temporary compression of material. The mechanism for the generation of density wave is unclear, but it is thought to be similar to the traffic jam on highway.

Credit: http://universe-review.ca/F05-galaxy.htm