A microwave uses an electromagnetic field to generate heat inside of food. This is done by exciting the water molecules in the food, which causes them to move and create friction. The motor in a microwave oven spins a metal plate called a magnetron. This magnetron produces the microwaves that heat the food.