Arduino Nano 33 IoT disconnected from IoT cloud when a source is applied

I'm not really a hardware person. Are your relays relay modules or just relays? For the latter,

  1. You're missing flyback diodes over the transistors.
  2. What is the coil current?

Why do you mix BC337 and IRLZ44? I doubt that the BC337 is suitable to drive relays. The base current will be around 0.5mA and with a worse case HFE of 60 you can only drive 30 mA (as said, not really a hardware person so I can see this wrong).