An astrophysical Dynamo is a mechanism by which a body transforms thermal and Kinetic Energy into electrical energy and through it, generates and maintains Magnetic Fields. It is analogous to an artificial mechanical dynamo, a type of electric generator, but rather than a mechanical commutator, electricity is carried by fluids that are moving and conduct electricity. The body must be spinning and carry a conducting fluid. The mechanism works according to the rules of Magnetohydrodynamics.
There exists a "chicken-and-egg" issue: electrical current is generated by a conductor moving through a magnetic field, which, in turn, is formed by the electrical current. Starting the process only requires that a weak magnetic field be present, e.g., a weak magnetic field surrounding it.
The Earth's magnetic field is maintained by such a dynamo (the Geodynamo), with molten Iron in the core being the conducting fluid. The Sun also has such a dynamo (Solar Dynamo), its gaseous interior being a conductor: this is the solar Magnetic Dynamo model thought to explain the visible Solar Cycle. Other stars, planets, as well as galaxies are thought to maintain magnetic fields through the dynamo mechanism. I assume the Sun's magnetic field could "seed" the Earth's dynamo, but I'm not sure how magnetism was first triggered in the solar dynamo: perhaps by convection including ions.
The presence of a Magnetic Field around a Rocky Planet or Moon implies the presence of a dynamo, implying a Molten Core, Convective Mantle and Plate Tectonics. Such convection, in turn, is a sign of World Cooling, e.g., from residual heat or from an active energy source such as radioactivity or Tidal Forces. Weak and/or scattered magnetism that suggests a dynamo in the past but not the present can reveal information about the thermal history of the body, a case in point being the Moon.
While there is evidence that dynamos produce the magnetic fields of astronomical bodies, realistic models of convincing detail remain a challenge and it has been established that some asymmetry, e.g., from Turbulence is necessary, i.e., that an axis-symmetric magnetic field wouldn't produce one. One attempt to model the complexity is to apply something like Reynolds Decomposition to MHD, which has been called Mean-Field MHD, and the corresponding theory of dynamos, the Mean-Field Dynamo Theory.