Different parts of the Sun spin around at different speeds. The Sun's equator spins fastest. The poles spin more slowly. This makes the Sun's magnetic field get all tangled up. 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.