How does the microwave oven works?
Sounds like you know this already. Light waves (like microwaves) are made of an electric field and a magnetic field, moving together through space. As the fields move, they oscillate. When a charge is in an electric field, it feels a force. If the electric field is oscillating, the force keeps changing direction (up/down). This causes the charge to move up and down. Some molecules have charge distributed in a non-uniform way. Water is a good example. They are called polar, because they are polarized in that they have a lopsided distribution of charge. These polar molecules respond to the field by the positive end going one way and the negative end going the other. When the microwave hits the polar molecule, the molecule shifts its orientation rapidly (rotating). Like you said, this rotating causes friction. All polar molecules will do this, but water very powerfully influenced and abundant in foods.