Metallurgical engineer Michael L. Free of the University of Utah offers this explanation:
Stainless steel remains stainless, or does not rust, because of the interaction between its alloying elements and the environment. Stainless steel contains iron, chromium, manganese, silicon, carbon and, in many cases, significant amounts of nickel and molybdenum. These elements react with oxygen from water and air to form a very thin, stable film that consists of such corrosion products as metal oxides and hydroxides. Chromium plays a dominant role in reacting with oxygen to form this corrosion product film. In fact, all stainless steels by definition contain at least 10 percent chromium.
The presence of the stable film prevents additional corrosion by acting as a barrier that limits oxygen and water access to the underlying metal surface. Because the film forms so readily and tightly, even only a few atomic layers reduce the rate of corrosion to very low levels. The fact that the film is much thinner than the wavelength of light makes it difficult to see without the aid of modern instruments. Thus, although the steel is corroded on the atomic level, it appears stainless. Common inexpensive steel, in contrast, reacts with oxygen from water to form a relatively unstable iron oxide/hydroxide film that continues to grow with time and exposure to water and air. As such, this film, otherwise known as rust, achieves sufficient thickness to make it easily observable soon after exposure to water and air.
In summary, stainless steel does not rust because it is sufficiently reactive to protect itself from further attack by forming a passive corrosion product layer. (Other important metals such as titanium and aluminum also rely on passive film formation for their corrosion resistance.) Because of its durability and aesthetic appeal, stainless steel is used in a wide variety of products, ranging from eating utensils to bank vaults to kitchen sinks.