In short, you're probably overloading your regulator.
It's difficult to say for sure, but I have a suspicion and can give a framework for thinking about it with some very crude numbers.
If you're powering the Nano from a 12 V source, you are dropping 7 V across the regulator. If you do the math on this 7 V drop, it means every 14 mA drawn through the regulator induces nearly a tenth Watt of heat in the regulator. 7 V * 0.014 A = 0.098 W. I'm guessing you have a budget of perhaps 300mW based on the way the Nano's regulator is set up.
The ATmega328P says it uses 5.2 mA (typical) or 9 mA (maximum) at 5 V and active at 8 MHz. But really it will use more at the 16 MHz frequency. For sake of argument, I'm just going to say it's using 14 mA, because it makes the math easy and because power usage scales somewhat linearly with frequency.
Just the power led will use about 3 mA, if it's an official Nano, but for simplicity sake, I'll call it 7 mA, being half of 14 mA and we'll ignore the fact that there are other loads on the board like the serial transceiver.
Your relay coils will use at least 30 mA, but likely more, perhaps a lot more. But for ease of calculation lets go optimistic and say they only use 28 mA (cause 2 * 14 mA).
So we have the ATMega328P inducing 100 mW in the regulator, the power led and some extras adding 50 mW. at at least one relay coil energized for another 200 mW. So right there you're already at 350 mW. If you screwed up and managed to energize both relays, 550 mW. Hopefully the regulator will enter thermal shutdown when this happens, in which case all you need to do is let it cool down and, you know, stop doing that. But it may also just die,which is more likely if you have a clone that happens to use a crappier regulator.
But, I think these numbers are conservative. For example, a datasheet for a Songle SRD-05VDC-SL-C relay that a lot of these modules use seems to say it will use closer 70 mA each, rather than 28 mA. This means operating just one of these coils by itself, nevermind the rest of the Arduino, will cause nearly half a Watt to be dissipated in the regulator if you're powering from 12 V. If you managed to turn on both coils well... nothing good.
If this is not the problem you're having, it is a problem. You can save yourself a fair bit of trouble by powering your Nano from USB with a powered hub or reasonable quality USB-output wall adapter. Doing so bypasses your regulator altogether.
If you're going to continue staging down 12 V to 5 V for the relay coils, then you may need an external regulator to operate the relay modules, just to unload the the Nano's regulator. Exactly how you'd go about that depends somewhat on the construction of the relay module. Some of them make it a bit easier on you and are design to accept voltage from a second source for the coils.