Metal expands when heated because an increase in temperature is actually an increase in the vibration of the atoms that compose the metal, and this vibration forces the atoms slightly apart. Unless a phase change occurs, the increased distance is not enough to break the lattice structure between atoms. Thermal expansion is a phenomena observed in most materials and not just in metals.
Thermal expansion is an important property of many materials, and few materials break the pattern of expanding as they increase in temperature. However, solid water and, at low temperatures, even liquid water, actually shrinks as it heats up. Water is an exception, however, with a relatively unique molecular structure and properties that cause its solid state to be less dense than its liquid state.
Thermal expansion is not only a common property but also an important one. Different metals expand at different rates with temperature change, which is a feature used in bimetallic strip thermometers. While thermal expansion is useful in this way, it is also often a problem in construction, particularly when several different materials are used or when heating is likely to be uneven. Shrinking and expanding metals produce stresses in structures, which can cause structural instability over time.