As Diana explains in the video above, a microwave oven works like a farady cage, which is essentially a metal box that 'filters out' electromagnetic waves.
So when electromagnetic radiation hits the outside of a Faraday cage, or the metal grate in the microwave door, it causes electrons in the metal to move and create an electromagnetic field that exactly opposes and cancels out the radiation. Sort of like how noise-cancelling headphones block out noise by playing opposite wavelengths of sound.