This may have happened for a few reasons (I've had this happen with muffins a few times!). 1) You opened the oven door while your cupcakes were baking. 2) You over-mixed your batter. 3) You overfilled the cupcake liners. 4) Your oven was set too high. 5) You let the batter sit too long before putting it in the oven. 6) Your baking powder or baking soda was not fresh or expired.