It's actually a misconception that metal can't go in a microwave. We often put specialized kinds in the microwave, including thin layers of aluminum food wrap that come with prepackaged food containers. Those specially designed food wraps work in the microwave because their shape allows them to absorb microwave radiation. In addition, the walls of a microwave's cooking chamber are lined with metal. The oven's metal walls and the metal in the oven's glass keep microwaves trapped inside for safety.
Most metals shouldn't be put in a microwave, though, because of how well they conduct electricity. That great conductivity prevents metal from effectively absorbing microwaves. As a result, those microwaves are reflected away from a metal's surface. It's this reflection that causes the electrical arcing or flashing you may see when microwaves begin moving inside the oven's heating chamber.
Some microwave ovens come with metal trays or racks. However, they're shaped in ways that make them safe. The U.S. Department of Agriculture recommends against using containers not clearly labeled as being microwave-safe. As an example, aluminum foil shouldn't be used. It's too dense and irregularly shaped and will reflect microwaves. The result could be dangerous with excessive arcing or flashing in the oven's cooking chamber.
At minimum, placing the wrong kind of metal container in a microwave oven might result in improperly cooked food. More seriously, the oven's microwave-generating device, the magnetron, can end up damaged or destroyed. Sensitive electronics within the oven may also be damaged. Over time, the oven will lose its effectiveness and break down for good if it's continually stressed in such a manner.