A microwave generates heat inside the food itself. The microwaves cause the millions of molecules present inside to turn over and return very rapidly and to rub against each other. The rubbing of the molecules together generates frictional heat in the same way that the heat is generated when both hands are rubbed together.
This helps with faster and more economical cooking.