The colour change is usually due to a buildup of our sweat, skin oils, hair oils, and drool – and parts of these deposits, like proteins and fats, yellow with age. (Rarely, clear sweat changes hue after contact with bacteria in a process called pseudochromhidrosis.)
Article source: https://www.huffingtonpost.co.uk/entry/how-to-whiten-yellow-pillowcase_uk_6a2ac74be4b01046d717220a