The sun’s magnetic field changes polarity approximately every 11 years. It happens at the peak of each solar cycle as the sun’s inner magnetic dynamo re-organizes itself. The sun’s polar magnetic fields weaken, go to zero and then emerge again with the opposite polarity. This is a regular part of the solar cycle.
View associated news item at https://www.nasa.gov/content/goddard/the-suns-magnetic-field-is-about-to-…