They do not pull towards all metal items just ferromagnetic materials such as iron. The phenomenon is due to principle of quantum mechanics. See http://en.wikipedia.org/wiki/Ferromagnetism for more detail.
Why do magnets pull toward metal items?