arduino Controlling Circuit Hangs when controlling 230v ac fan using a relay

I see you're not using opto isolation for your relay circuit. This would have really helped with eliminating any conductive interference on the power rails when the relay contacts are switched.

I'm quite sure that if you install MOVs like these, it would cure or greatly reduce the problem (emissive RF from contact arcing). The MOVs could be installed from the NO to COM contacts. Additional MOV's would be needed from the NO to COM terminals if 230VAC load is switched here.

Also, you may need to increase the distance from the relays and electronics.

Also, a ferrite core on the DC power rails (relay power & GND) would be a great help. Use multiple turns if possible. Others have used a ferrite core in the AC load wire with great results.