Arduino autorestarts when powered externally
https://www.arduino.cc/en/Main/ArduinoBoardUno

Majenko has a good lead,

12V is just within spec of the voltage regulator.

Though this may be different per manufacturer or different in your environment.

To battle overheating you can:


Create beter airflow
Add a heatsink
Draw less current


But you should try a 9V source, that can deliver enough current (not the 9V "block" batteries).

Also check if the system draws excessive current, maybe the circuit has a low resistance or power hungry part (on the 5V rail)

If nothing works, you could try and use another Arduino board, maybe the regulator is faulty/damaged.