Answer:
The Earth's magnetism is generated in the core, which is composed of iron that is constantly churning
Step-by-step explanation:
Magnetic fields are produced by charges in motion, therefore by currents.
The outer core of the Earth consists mainly of melted iron that is in constant motion. This iron in motion actually acts as a giant current, and therefore it is responsible for the creation of the Earth's magnetic field.
The magnetic field of the Earth is very weak, in fact its magnitude is on average between 25 and 65 microtesla (for comparison, normal magnets can even produce magnetic fields of a few millitesla).
However, its role is very important for the Earth: in fact, it provides a shield that blocks most of the harmful radiation coming from the Sun.