What did I do wrong? Do I need put a diode between LM7805 and +5V line?
Feeding a voltage into the wrong end of the regulator is not recommended, however I have never come across a case of this burning out the regulator.Was the 12V supply left connected up but not powerd up. That could cause a short on the input side and produce what you saw. If this is the case then a diode would prevent this from happening.
QuoteWhat did I do wrong? Do I need put a diode between LM7805 and +5V line?Typically a reverse-connected diode between 7805's input and output.