My guess, based on what you've said, is that the two processes involved (that are giving you the off-smells) are oxidation and rancidification.
Rancidification ("going rancid") is a process by which fats (oils) break down into... other chemicals you don't want (and smell bad). The smell could be described as rank or rotten.
Oxidation is another class of chemical reaction that could also produce off-smells and tastes. This could be caused by contact with air (specifically, for example, oxygen) or other factors.
More broadly, autolysis describes other factors of, for example, plant material breaking down by itself over time (e.g., self-degredation by a cell's own enzymes). There are likely other factors like this, if you store coffee (especially pre-ground!) for any length of time.
These descriptions are admittedly non-technical. If you're looking for more, ping me in comments.
See also this question and its answers: When does coffee go off? It discusses oxidation and other factors.