I would guess switching on the AC device either causes electrical interference (the spark on the relay can be quite bad) which breaks your WIFI signal, or interrupts the power supply to the ESP8266, which can cause WIFI to fail.
But you really really really need to be more descriptive if you want a helpful answer :)
- What is your exact setup, what is connected to what, and how, how are your power supplies organized, etc.
- I wouldn't rule out a software error either, so can you give some details on your software setup also?
- Be specific on the details on the failure, what does 'wifi connection automatically disconnecting' mean, exactly? Log files help.