In order to help you, we need to see your code and understand your wiring. And we need you to be specific about the problem, what you've tested and found, and details about your grounding connections (as has been suggested).
Is your AC / DC adapter providing a grounded output or floating? What is the connection shown as a red conductor on the diagram - is that an AC ground or is it the AC Phase (hot) wire?
Also,what is the available power at the DC adapter? For example, have you added up all the required power needed to drive the relays, the ESP and the 595 plus any other circuitry that may not be shown? If the adapter cannot supply sufficient power during relay switching for example, then there's no telling what the outputs might do. We don't know if your relays are opto isolated, or whether they are high side or low side switching (which may be affected by the grounding issues previously mentioned. People here want to help. We need all the detail.
You see, we cannot help because we do not know enough about your circuit, your code and your problem. We know only what you have said so far, and it's not enough to diagnose your problem and help you resolve it.