Answer: Ethylene.
Ethylene is also an important natural plant hormone, and is used in agriculture to force the ripening of fruits, and also is naturally occurring (but not in such high amounts such as the ones you see on store shelves -- these are forced to ripen quickly compared to naturally occurring levels (which has low levels of ethylene at a time in comparison of forced ripening which has increased levels of ethylene at once).
Ethylene it is what causes a maturing apple to go red, and then that red apple starts to wither, get squishy/ soft, and then it starts to rot.