Corrosion is related to the metals while the rancidity is related to the foods. The corrosion consists of the contact of the metals with moisture and oxygen while the rancidity means the reaction of fats in food with the oxygen. Also the rancidity is more rapid process than that of the corrosion.
Corrosion is spoiling of metals like reaction of silver with sulphide in the air and forms silver sulphide.
Rancidity is spoiling of food like reaction of food with o2 in the air and bacteria attacks on it. Thus , leads to release of bad fumes from the food.