A microwave oven cooks food differently than a standard convection oven. Almost all foods contain some amount of water. When you turn on a microwave oven, the microwaves causes the food's water molecules to vibrate and as they do, they heat up. The heated water molecules then cook the food.

A hard-boiled egg contains a large amount of water even though it seems to be somewhat solid. As the water inside the egg begins to heat up, it will expand putting pressure on the inside of the egg. Once the expanding water, now a vapor, grows beyond the volume of the egg, it will build up enough pressure and the egg will explode. You can better see this effect with a marshmallow. Place a marsmellow in a microwave oven and set it for about 15 seconds and watch what happens. The same thing happens with the egg, except that it takes a bit more time for the egg to get hot enough to explode.