I have a Sony Xperia Z2 and this auto-connect to WiFi has been driving me up the wall for months, and the Z2 doesn't seem to have the setting to switch off auto-reconnect, but tonight I finally found out how to stop it:
The answer:
Go to Settings, tap WiFi. It will turn itself on, ignore that for now.
Tap the three dots menu top right, and tap "Saved Networks". This can only be done while wifi is on, it's greyed out otherwise.
For each saved network, long-tap it, a pop-up appears with an "auto connect" tickbox, pre-ticked. Untick the box. This should put an end to random wifi reconnects.
Background:
On the Z2 I have a VoIP app that connects to an Asterisk PBX inside a company VPN, via which I can receive Support calls. I also have 20 gig of 4G data a month, so no need to try and economise via wifi. So at home I'd turn wifi off from the top bar, connect to the VPN over 4G, and fire up my VoIP client to receive calls. And then after some random period of time the phone would decide to auto re-connect to wifi, breaking the VPN connection and disconnecting the VoIP. However the wifi signal in my workspace is very weak (router on ground floor, workspace in the attic - main PCs are on a wired network), so as soon as it had connected it'd drop off again. Plus all the random turning back on after I'd turned it off would waste battery power - if I turn a thing off I expect it to stay off. I came close to throwing the phone a few times.
I've googled this issue many times but all the threads on various forums referred to settings and apps that do not exist on my phone. Found the solution I've detailed above by chance this evening while out of desperation trying every conceivable option and tap-type. Given the number of frustrated users I saw on various threads, I hope this answer is of use to other people in the future.