Stainless steel resists rust because it contains a high proportion of chromium to carbon. Before the arrival of this alloy just before the First World War, knives and other household articles made of steel easily rusted unless very carefully dried.
It was an English researcher named Harry Brearley who discovered that rust was encouraged by the carbon in steel and other metals. The less carbon and the more chromium in steel, the better it would resist rust.
But a careful balance had to be struck. Completely carbon-free steel was impossible to make, and only a limited amount of chromium could be included, because it tended to make steel brittle. Brearley discovered a satisfactory formula only after many experiments.