The spectrum of electromagnetic radiation contains a part known as microwaves. These waves have frequency and energy smaller than visible light and wavelength larger than it.
How does it works?
Our objective is to cook food or warm it up. All food items such as fruit, vegetables, meat, cereals, etc., contain water as a constituent. Now, what does it means when we say that a certain object has become warmer? When the temperature of a body raises, the energy of the random motion of atoms and molecules increases and the molecules travel or vibrate or rotate with higher energies. The frequency of rotation of water molecules is about 300 crore hertz, which is 3 gigahertz (GHz). If water receives microwaves of this frequency, its molecule absorb this radiation, which is equivalent to heating up water. These molecule share this energy with neighbouring food molecules, heating up the food.
One should use porcelain vessels and not metal containers in a microwave oven because of the danger of getting a shock from accumulated electric charges. Metals may also melt from heating. The porcelain container remains unaffected and cool, because its large molecules vibrate and rotate with much smaller frequencies, and thus cannot absorb microwaves. Hence, they do not get heated up.
Thus the basic principle of a microwave oven is to generate microwave radiation of appropriate frequency in the working space of the oven where we keep food. This way energy is not wasted in heating up the vessel. In the conventional heating method, the vessel on the burner gets heated first, and then the food inside gets heated because of transfer of energy from the vessel. In microwave oven, on the other hand, energy is directly delivered to water molecules which is shared by the entire food.