The comet was hit by a coronal mass ejection during its pass near the sun; some rumoured it had disturbed the sun, but scientists dismissed this notion.
The resulting coronal mass ejection can be compared to a horseshoe magnet, the sunspots being the poles and the oscillating magnetic connector the handle.
This usually happens before the coronal mass ejection is able to cool enough for the magnetism to dissipate, at which point the solar flare cycle begins again.