Water is a chemical compound found not only in the rivers, oceans and other bodies that cover almost three-fourths of the surface of the Earth, but also in the tissues of plants and animals. Water accounts for about two-thirds of the weight of an average human body, and it must be regularly replenished to maintain this balance at the rate of two to three quarts a day. We obtain much of this from the water content of foods rather than drinking water. Even foods commonly thought of as dry usually have substantial moisture contents. This enables microwaves to heat food without causing the dishes, walls of the microwave, or air inside it to heat up. More precisely, the high-frequency electromagnetic waves (termed microwaves) produced by the microwave oven selectively heat water, so food is heated while other items exposed to the waves are not.
To better understand how this is possible, consider the single water molecule and electron illustrated in this tutorial. Click and drag the electron (presented as a yellow ball marked by a negative sign) to move it around the water molecule (the red and blue figure) and observe their interaction. Notice that by moving the electron in certain ways, the water molecule can be forced to rotate. This is because a molecule of water is composed of two hydrogen atoms and one larger atom of oxygen; these atoms are joined in a distinct V-like shape, with the oxygen atom forming the vertex and the hydrogen atoms at the tips. Due to the organization of the atoms and the uneven sharing of electrons, the charge of a water molecule is not evenly distributed. In fact, the oxygen atom exhibits a partial negative charge and hydrogen atoms exhibit a partial positive charge. Since like charges repel each other and unlike charges attract, the molecule of water continually attempts to reorient itself so that its positive side faces the negatively charged electron. This constant reorientation produces the rotation of the water, which in turn produces heat.
To understand how the rotation of water molecules produces heat, keep in mind the much larger scale of activity taking place in an actual microwave. Instead of an individual molecule, as shown here, there are vast numbers of water molecules in any given item of food. Also, the electric force triggering their motion is generated not by a single electron, but by electromagnetic waves made up of huge quantities of electrons. All these water molecules moving around and bumping into each other generate friction, which produces heat and warms the food. The greater the density of water molecules, the more friction produced and the hotter the food will be. Even though the air in the microwave likely contains some water molecules, it is not appreciably heated because it is much less dense than liquid.