Actually, this is a really good article explaining Magnetics.
All magnetic fields are produced by moving or spinning charged particles…somewhere.
Magnetism is a force in nature that is produced by electric fields in motion. This movement can involve electrons 'spinning' around atomic nuclei, flowing through a conducting wire, or ions moving through space in an organized stream. The remarkable thing is that whenever a charged particle moves, the electric field it produces is also moving through space, and it is this moving electric field that is detected as a magnetic field.
Electromagnets are created when electric currents move through a conducting wire. When you turn off the current by removing the battery, the magnetic field vanishes, so it is obvious that a current is involved in generating the magnetic field.
(much more at link)