Arduino freezing after moving from Mega to Nano.

Did you get any compiler warnings about the size of your code or memory usage ?

This, for example, would be fine:

Sketch uses 1834 bytes (5%) of program storage space. Maximum is 32256 bytes.
Global variables use 207 bytes (10%) of dynamic memory, leaving 1841 bytes for local variables. Maximum is 2048 bytes.