Only irons and metals that contain iron, such as steel, become rusty. Iron rusts when it comes into contact with (mostly) water and air. This is because the water and oxygen in the air react with the iron. This reaction produces reddish brown rust flakes. The speed of rust can increase by some substances such as salt.

A bicycle frame is often made of steel and will rust if the metal comes into contact with air and water for a longer period of time. The frame is protected by paint, but where the paint is peeling, rust forms on the iron underneath.

A bicycle chain is made of steel. So it will rust. To prevent this, you can lubricate oil on the chain against water.

The less iron in the metal the better. Using wrought iron instead of pure iron can protect against rusting. Wrought iron has a higher carbon content than pure iron, and with more carbon, it’s naturally better protected against rusting.