You already know that if you bring a magnet near an iron nail, the nail will experience an attraction towards the magnet. Not all metals, however, behave in the same way. Some metals are what scientists call ferromagnetic, meaning they become permanently magnetized by a magnet. Others are paramagnetic, meaning they are only temporarily magnetized, and still others are diamagnetic, meaning they experience a weak repulsion from a magnetic field.
Electrons have a property called spin, which is a little like angular momentum (for example, a ball spinning around its axis), although it's important not to take this analogy too far, since electron spin is ultimately very different from the kind of spinning motion you know in everyday life, such as a rotating top. An electron can have a spin of either +1/2 or -1/2. Consequently, electrons act a little like tiny magnets. If two electrons are paired in an orbital, the magnetic fields they produce cancel each other out, and the atom has no net magnetic field.
In ferromagnetic materials like iron, atoms have net magnetic fields and are grouped together with other atoms in a small subunit called a domain. A domain may in turn be aligned in any random direction or aligned in the same direction, together with all its neighbors. Ordinarily, the magnetic fields are not aligned, and so a lump of iron metal by itself has no net magnetic field; the randomly aligned magnetic fields of individual atoms cancel each other out. When an external magnetic field is applied, however, the atoms line up with it, so the object becomes magnetized.
In a diamagnetic field, each atom has paired electrons, so all the magnetic fields created by individual electrons cancel. When you bring a diamagnetic object near a magnet, you create tiny current loops in the atoms of the material, much like miniature loops of wire. In keeping with a law of physics called Lenz's Law, the currents you create run in such a direction that they produce a magnetic field opposing the one you applied.
Not only does a diamagnetic metal like copper experience no attraction for a magnet, it actually experiences repulsion. This repulsion is very weak, so unless the magnetic field is very strong, you won't see it. Nonetheless, this effect results from the metal's structure at the atomic level. Copper has all paired electrons in the so-called d-orbitals, so the atoms in copper do not have net magnetic moments. Diamagnetism is by far more common among the elements of the periodic table than ferromagnetism or paramagnetism.