At its core, a microwave oven is a pretty simple device. It’s basically just a magnetron hooked up to a high voltage source. This magnetron directs microwaves into a metal box. These generated microwaves then bounce around inside the microwave until they are absorbed via dielectric loss in various molecules, resulting in the molecules heating up. Matter that works well here for heating are things such as water, ceramics, certain polymers, etc. These all end up converting microwave energy into heat quite effectively.
More specifically, Microwave ovens work by having an internal magnetron emit electromagnetic waves around the frequency of 2.45 GHz (vibrates at about 2.45 billion times per second). These waves are absorbed by water molecules, fat molecules, sugars molecules, and certain other substances, which then heat up by a process known as “dielectric heating”. Basically, molecules such as water molecules are electric dipoles. This means that they have a positive charge and a negative charge on opposite ends. Thus, they will rotate themselves rapidly when trying to align themselves with the alternating electric field from the microwaves. As these molecules rub against each other, they heat up and, as they do so, they themselves also become part of the cooking process, heating up molecules around them that may not be absorbing much, or any, of the microwaves.