Here's why:
* The outer core is liquid: Made of iron and nickel, it's constantly moving due to convection currents caused by heat from the Earth's interior.
* Convection and rotation: The movement of molten metal within the outer core, combined with the Earth's rotation, creates electric currents.
* Dynamo effect: These electric currents generate a magnetic field, similar to an electromagnet.
So, while the entire core plays a role, it's the liquid outer core that is directly responsible for creating the Earth's magnetic field.