A magnetron is the device which produces the microwaves in a microwave oven, originally developed during WWII as a small and high powered source of microwaves for radar applications. A strong magnet causes a stream of electrons to circle around a series of cavities causing them to resonate electrically in much the same way as blowing across the top of a bottle can make it resonate.