The fact that the Sun's magnetic field changes dramatically over the course of just a few years, and the fact that it changes in a cyclical manner indicates that the magnetic field continues to be generated within the Sun. Magnetic fields are produced by electric currents. These currents are generated within the Sun by the flow of the Sun's hot, ionized gases. We observe a variety of flows on the Sun's surface and within its interior . Nearly all of these flows may contribute in one way or another to the production of the Sun's magnetic field.
Magnetic fields are a little like rubber bands.
They consist of continuous loops of lines of force that have both tension and pressure. Like rubber bands, magnetic fields can be strengthened by stretching them, twisting them, and folding them back on themselves. This stretching, twisting, and folding is done by the fluid flows within the Sun. Click on image for larger version. The Omega Effect Magnetic fields within the Sun are stretched out and wound around the Sun by differential rotation - the change in rotation rate as a function of latitude and radius within the Sun.