Why did my MOSFET explode?
Some things that can make a MOSFET pop:


Too high Vds voltage, i.e. a 20V MOSFET on a 24V system wouldn't last long.
Exceeding power dissipation (could be a short circuit, but can also be due to very high frequency switching. If you're not using a SMPS, this probably isn't relevant.)
Exceeding Vgs(max), which is usually ±20V. This is quite a common failure leading to the breakdown of the delicate gate insulator.
Reverse biasing the drain and source making the body diode conduct (as Nick T mentioned.)
Mechanical stress can cause bonding wires to fail or short to places they shouldn't, but this is rare.
If you mounted it on a heatsink remember that the tab of the MOSFET is connected to a pin, usually source, but sometimes drain. If you grounded the heatsink it could cause Bad Things to happen.