Rancidity is primarily the hydrolysis and auto-oxidation of fats and lipids. The product of these process, such as ketones and aldehydes, are vastly responsible for the foul smell and unpleasant taste of rancid food.
Factors that influence auto-oxidation of fats include light and and heat, among others, as they accelerate the speed at which the fats present in food act with oxygen. Light provides energy that speeds the oxidation of fat.
Hence it is true that storing foods in dark places can slow the process of food rancidness.