Here's why:
* Composition: The outer core is a liquid layer composed primarily of iron and nickel, with trace amounts of other elements.
* Convection: The intense heat from the Earth's inner core causes convection currents within the liquid outer core. This movement of molten metal acts like a giant dynamo, generating electrical currents.
* Magnetic Field: The electrical currents created by the convection generate a magnetic field that extends far beyond the Earth's surface, creating the magnetosphere.
So, while the entire Earth has a magnetic field, the outer core is the driving force behind its generation.