The gases in the Sun rotate faster at the equator than the poles. Also, the interior of the Sun has gas which is convecting energy to the surface like the water in a boiling pot. Subsurface magnetic field 'lines' are trapped in the gas and two things happen. First, the differential rotation of the surface causes the magnetic field lines to get stretched and wrapped around the min- latitude regions of the Sun, becoming more and more concentrated towards the lower latitudes as the solar cycle progress. Concentrated sub-surface magnetic fields become 'buoyant with respect to the gas, and as they rise to the surface, the convection and rotation cause these magnetic fields to get cyclonically twisted. When they punch through the surface, the magnetic fields produce pairs with opposite polarity. The orientation of the sunspot magnetic fields relative to the magnetic hemisphere they are in, is reversed with the S-pole leading the spot in the North magnetic hemisphere, and the opposite true in the South magnetic hemisphere. Eventually, as these sunspot fields expand and merge 'stocastically' the S-spot pole establishes dominance in the North magnetic hemisphere which causes the polarity reversal. Then, after the concentrated sub-surface fields have mostly all emerged to produce the sunspot fields, the process begins anew with the new, reversed field becoming concentrated in the mid-latitudes...etc.
All answers are provided by Dr. Sten Odenwald (Raytheon STX)
NASA IMAGE/POETRY Education and Public Outreach program.