How was the microwave oven invented?

Percy LeBaron Spencer is considered to be the inventor of the microwave oven. He was working as an engineer with the Raytheon company when he was experimenting with and testing a magnetron. The magnetron had already been invented during WWII and allowed the Allies to determine the exact locations of Nazi war machines and arsenals, as the magnetron produced microwaves which radar then bounced off the arsenals, and back to the Allies.

The magnetron was passed to Raytheon in the USA for further development and during testing Dr Spencer reached into his pocket for his chocolate bar and discovered it had completely melted. He noted the connection between the melted chocolate and the heat-producing magnetron, and tested his theory on a bag of unpopped corn kernels, which then popped. In further testing, he placed an egg in front of the magnetron, and the egg exploded.

For this reason, Spencer is credited with discovering one of the critical components of the microwave oven. Further modifications of the microwave oven developed out of his observations, and by 1947 Raytheon had perfected a commercial microwave oven.