Here's why:
* The Earth's core is made of iron and nickel. This metallic composition is crucial for generating the magnetic field.
* The core is divided into a solid inner core and a liquid outer core. The liquid outer core is constantly moving, creating electric currents.
* These electric currents generate a magnetic field that extends far out into space, forming the Earth's magnetosphere.
So, while we often talk about the Earth's magnetic field, it's important to remember that it originates deep within the Earth's core.