Most baked products have an infrastructure of starch (from flour) reinforced with egg proteins, and filled with fats and sugars and the most important - air. The starch portion of the flour gels and creates a web-like protein-gluten mesh. The carbon dioxide from the baking powder or baking soda will expand the cake. The protein-gluten mesh holds those bubbles in place.
These air bubbles need to set. If given proper resting time the whole protein network hardens and holds the bubbles in cakes. But when the gluten is hot, it's still very soft and can easily collapse is exposed to cold air. When you expose it to a sudden cold air, the bubbles contract, with the protein mesh not firm enough to hold. That’s why when you take a cake out early from an over, the cake can collapse because a structure hasn’t set yet. The simple answer as to why cakes collapse is the network of proteins and starches are not strong enough to hold the expansion of air.
These air bubbles need to set. If given proper resting time the whole protein network hardens and holds the bubbles in cakes. But when the gluten is hot, it's still very soft and can easily collapse is exposed to cold air. When you expose it to a sudden cold air, the bubbles contract, with the protein mesh not firm enough to hold. That’s why when you take a cake out early from an over, the cake can collapse because a structure hasn’t set yet. The simple answer as to why cakes collapse is the network of proteins and starches are not strong enough to hold the expansion of air.