The reason your windows become steamed up or foggy is that water droplets condense out of the air onto the glass. The moisture in the air is not attracted to the glass specifically; rather, the moisture condenses on the coolest surfaces in the area. The windows are usually the coldest surface in a residential home or office building.
Temporarily steamed up windows are usually no cause for concern. Common activities that cause windows to become temporarily fogged include hot showers, boiling water in the kitchen and faulty dryer vents. All of these activities fill the air with excess moisture; once the air reaches the saturation point, the water condenses out of the air onto cool surfaces.
In cases where the windows of a home are always slightly foggy, problems that are more serious may be to blame. If there is a slow leak inside the walls of a home, the excess moisture may cause the windows to remain steamed. New homes are more likely than old homes to experience this phenomenon as older houses were not built to the same standards as modern homes. This means that old homes have more air flowing through the house, which reduces the internal humidity.