Microwaves are a very complicated machine, but let me break it down for you. First, there is a device inside of the microwave called a Magnetron. This Magnetron produces microwaves, which are a low energy wave on the Visible Light Spectrum. The humming sound is actually the fan that keeps the Magnetron cool. When you microwave food, the microwaves are released. The waves go through the food and bounce off the walls of the microwave. These microwave waves get the molecules of water, in every type of food, to speed up. This speeding up creates friction and friction creates heat. Thank the water molecules in your food for keeping it nice and warm. All food has some water in it.
When the Magnetron was first discovered by Percy Spencer, the microwaves melted all of the food around outside of it! That is why the Magnetron is encased in a metal box to keep the microwaves from spreading out.