Dear student
Rancidity is produced by aerial oxidation of fats and oils which is marked by unpleasant smell.
Whenever food stuffs contain fats and oils, they get oxidized and remain no longer to be healthy to eat. For e.g.
If we eat chips from the packet, we do not fall ill because these packets are filled with nitrogen gas which prevent the oxidation of oils present in chips. If the chips company does not fill nitrogen gas in the packet, then the oxidation will take place and the chips cannot be eaten and get soured due to rancidity.
Butter also becomes rancid when not refrigerated or kept in environment having warm temperature, moisture etc that causes oxidation of fats.
Storing oily foods in refrigerators retards rancidity.
Regards