|MadSci Network: Astronomy|
As usual, there are many sites on the internet that address this question. While the exact cause of the sunspot cycle is not yet understood, current models favor the interaction of the suns rotation with the magnetic field generated by the dynamo effect of ionized gases within the sun. The resulting 11 year cycle is probably affected most by the size of the sun. Larger, longer cycle; smaller, shorter cycle. Near the equator of the sun, the rotation period is shorter by days than the period at higher latitudes. This differential rotation twists and distorts the sun's magnetic field, reversing its polarity with each cycle.
Try the links in the MadSci Library for more information on Astronomy.