from "Stuff Matters" by Mark Miodownik:
Paper yellows with age for two reasons. If it is made from cheap low-grade mechanical pulp, it will still contain some lignin. Lignin reacts with oxygen in the presence of light to create chromophores ( meaning, literally, 'color carriers'), which turn the paper yellow as they increase in concentration. This type of paper is used for cheap and disposable paper products, and is why newspapers yellow quickly in light.
It used to be fairly common to increase the textural quality of paper by coating it with aluminum sulfate, a chemical compound that is used primarily to purify water, but what wasn't appreciated at the time was that this treatment creates acidic conditions. This causes the cellulose fibers to react with hydrogen ions, which results in another form of yellowing. It also decreases the strength of the paper. Large number of books from the 19th and 20th centuries were printed on this so-called acid paper and can now be easily identified in book shops and libraries by their bright yellow appearance. Even non-acid paper is susceptible to this aging, just at a slower rate.