The three primary metal elements that are attracted to magnets are iron, nickel and cobalt. These are also the metals used to create most magnets, although some more powerful magnets use rare-earth elements, such as gadolinium or neodymium.
All materials have tiny internal magnetic fields called domains, but in these three ferromagnetic metals, the internal magnetic domains are uniformly aligned to give them a magnetic field. In all other elements, the internal magnets are either randomly oriented or cancel each other out, which is why these other metals don't have a magnetic field.
The ferromagnetic metals are often combined with other metals to create alloys, which also have magnetic properties. For instance, steel is an alloy made from iron that is magnetic, although not to the same degree as pure iron.
Most magnets are made from one of these three metals, which is then heated until the metal reaches its specific Curie temperature. The Curie temperature is the specific temperature at which a ferromagnetic metal takes on the properties of a magnet. If the material is only heated to the exact Curie temperature, the magnetic effects are only temporary. The magnetic properties can be made more permanent by heating the metal up beyond this temperature.