Moving charges create magnetic fields. Electrons have spin and hence act as magnetic dipoles. If all electrons in a molecule or atom are paired, these dipole moments cancel and there is no net magnetic field. In some materials, however, the atoms or molecules have unpaired electrons, so the atoms can be "lined up" by a magnetic field. These materials are either paramagnetic (if a magnetic field only reorients them temporarily) or ferromagnetic (if the reorientation is permanent) and are attracted to magnets. Many other substances, however, are not magnetic.
The term "diamagnetic" is a more technically accurate way of describing a material that is not attracted to a magnet. The atoms or molecules of a diamagnetic substance do not have net dipole moments, so they do not act as magnets. A diamagnetic substance is pushed out of a magnetic field, but with most materials the force is so weak you won't be able to observe it in everyday life. Diamagnetic metals include copper, silver and lead.
Some metals that are normally paramagnetic or ferromagnetic are only weakly magnetic when mixed to make an alloy. Some stainless steels, for example, contain iron but are not magnetic. These alloys are not attracted to magnets.
Compounds and Oxides
When metals form compounds with other elements, they may lose their magnetic properties because they now share electrons with other atoms and hence no longer have unpaired electrons. After iron has been oxidized to form rust, for example, it is only weakly, if at all, magnetic.