While other planets like Jupiter and Saturn also have magnetic fields, Earth is the only one known to have experienced numerous magnetic pole reversals throughout its history. This occurs when the Earth's magnetic field weakens, flips, and then strengthens again, with the north and south magnetic poles switching places.
This process is not fully understood, but it's believed to be related to the movement of molten iron in Earth's core.