Microwave ovens work by exciting the liquid molecules within food thus producing thermal energy, or heat, which ultimately cooks the food. The principle behind this involves the use of microwaves, a type of electromagnetic radiation, produced by a magnetron within the appliance and is known as dielectric heating. Thus, microwave ovens work best using foods that have a high moisture or fat content.
What Are Microwaves?
Microwave ovens are so named because they use microwave radiation to cook food. Microwave radiation is a form of electromagnetic radiation in the frequency of 300 MHz to 300 GHz. These wavelengths are much shorter than radiofrequency waves and must travel in a straight line so due to the curvature of the Earth, are useful only up to thirty feet. This limits their use to transmitting data between ground stations or satellites that are close. They are also used in radar technology and microwave ovens. 
How Do Microwaves Work in the Oven?
Microwave ovens are powered by a high voltage power source. This energy is transferred to a magnetron, which is a device used to convert electric energy to microwave radiation. The radiation then passes through a waveguide that controls the direction of the microwaves and sends them into the cooking chamber. The microwaves are reflected off the metal walls of the interior of the appliance and form standing waves, which then pass through the food to heat it. A turntable will move the food through the waves in attempts to evenly distribute hotspots that can form in the standing waves. 
How Do the Microwaves Stay Inside the Appliance?
The microwave oven unit works on the principle of a Faraday cage. A Faraday cage is a structure intended to block out all electromagnetic radiation that are present in the atmosphere such as radio waves and to confine other waves inside the unit. Microwaves cannot penetrate metal, and are instead reflected off. This is why microwave ovens are made of metal. All parts of the microwave must be covered in metal including the mesh covered glass door and light bulb cavity in order for this principle to work. 
How Do Microwaves Cook Food?
Some falsely believe that food is chemically altered when heated by microwaves. Microwave cooking is actually a simple process of exciting molecules to create heat.
Food contains molecules with dipoles, that is positive and negative poles. The microwaves change the polarity of the field causing the molecules the continuously flip, creating friction. This friction creates heat, which cooks the food item and is known as dielectric heating. Microwaves primarily work on the water molecules present in foods because they most efficiently absorb microwaves. 
All This Science Is User-Friendly
Microwave ovens utilize some kind of mechanical or electronic mechanism to control power output, time, safety, and the user interface. In modern appliances, this interface is almost always in the form of user friendly buttons and LED displays positioned conveniently on the front of the microwave oven. These devices allow the user to safely and easily adjust the cooking process without exposing themselves to the inherent dangers involved with manually manipulating the circuitry involved with the magnetron and its electric power supply.
 Occupational Safety & Health Administration
Radiofrequency and Microwave Radiation
 University of Mississippi
Journal of Physics Education; Michael Vollmer
Physics of the Microwave Oven
 Penn State News
Probing Question: How Do Microwaves Cook Food?
Glossary of Terms
Dielectric heating: method by which the temperature of an electrically nonconducting (insulating) material can be raised by subjecting the material to a high-frequency electromagnetic field.
Electromagnetic radiation: is a form of energy that is produced by oscillating electric and magnetic disturbance, or by the movement of electrically charged particles traveling through a vacuum or matter.
University of California, Davis
“Simple estimates easily show that the number of microwave photons within a commercial oven is orders of magnitude too small to establish multiphoton dissociation or ionization. One may therefore conclude that the food cannot be altered chemically while heated in a microwave oven.”
Michael Vollmer Physics of the Microwave Oven
“Although technically microwaves are a kind of electromagnetic radiation, we shouldn’t use the word ‘radiation’ to describe them—it scares a lot of people unnecessarily.”
Swamy Anantheswaran, Penn State professor of food science