The dynamo theory, which attempts to explain the origin of planets' magnetic fields, is supported by three lines of evidence: theoretical evidence from models, positive evidence from observations of planets with magnetic fields, and negative evidence from worlds without such a field. Some anomalous examples, such as Mercury, are exceptions.
Theoretical evidence for the dynamo theory consists of models in which a moving metallic fluid, such as the iron-nickel material of Earth's outer core, carries an electric charge. Moving charges generate magnetic fields, which argues for the existence and observed strength of Earth's magnetic field from first principles. Other worlds, such as Jupiter, are strongly suspected of having a large planetary ocean of liquid metallic hydrogen, which explains Jupiter's large, strong magnetic field.
Dynamo theory makes certain predictions. One is that a dynamo-induced magnetic field can exist only where a molten core exists within a fast-spinning planet. Small celestial bodies, such as Mars and the asteroids, long ago lost their heat, which shuts down the necessary convection near their cores. Venus is large enough to have retained its heat, but it spins very slowly, reducing the motion of its core and weakening the field. Mercury, which is too small to retain its primordial heat, does have a magnetic field as a result of its extreme inclination, which is allowed for in dynamo theory.