To understand how this happens, we’ll have to comprehend the basic properties of water molecules and microwaves (the electromagnetic waves, not the oven).
The mickey mouse-shaped water molecule is actually a dipole. That is, one side is positively charged while the other is negative.
Microwaves used for cooking, on the other hand, are electromagnetic waves possessing frequencies around the 2.45 GHz range. Now, electromagnetic waves are waves made up of alternating electric and magnetic fields. For this discussion, we’re more concerned with the alternating electric fields because charged particles readily react when exposed to them.
That is, when a positively charged particle is exposed to an electric field, it experiences a force (due to the field) pointing in the direction of the field. By contrast, when a negatively charged particle is exposed to the same field, it experiences a force in the direction opposite to the field.
Now, since an electromagnetic wave (like the microwave) is made up of alternating electric fields, a charge exposed to it will experience forces regularly changing in direction. For water molecules, which are dipoles, the net effect would force the molecules into rotation. Again, since the fields are alternating, the rotation will change from clockwise to counterclockwise at regular time intervals.
The agitated water molecules would then possess heat energy that can rub off (much like friction) to nearby molecules. If the water molecules are well distributed in the body subjected to the microwave (like food, for example), then the entire body can heat up quickly – not to mention, uniformly.
Electromagnetic waves in the microwave range are most suitable for this purpose because the water molecules readily rotate when exposed to such frequencies.
Avoid putting in metal into the microwave oven while heating. The reason is because pointed portions of the metal can accumulate high voltages which can cause dielectric breakdown of the air inside the oven. Once this happens, some harmful gases can be produced.
Since microwave ovens normally don’t have heating elements, temperature can drop right away in the inner walls of the oven. So you’ll only need to worry about getting burned by the food and not the walls.
You can read more about electromagnetic waves here in Universe Today. Want to know about how the 25-year old mystery of X-ray emissions was solved? We’ve also written about how astronomers resolved Milky Way’s mysterious X-Ray glow