Different parts of the Sun rotate at different speeds. The Sun's equator spins fastest, and the poles spin more slowly. This causes the Sun's magnetic field to get all tangled up over time. Loops in the tangled magnetic field poke through the Sun's surface sometimes. When they do, they make sunspots.
Windows to the Universe original artwork.