The Sun’s radiative interior extends to about two-thirds of the solar radius and is the source of our star’s rotation; photons and other particles carry heat in this region of the solar interior. This, in turn, feeds convection, which stirs the plasma under the Sun’s visible surface (called the photosphere). The interaction between convection and rotation in the upper third of the Sun’s interior creates strong magnetic fields, which rise through the interior and thread through the surface, making sunspots, prominences, and all kinds of beautiful structures.
Astronomy magazine subscribers can read the full answer for free. Just make sure you're registered with the website.