How to prevent iPhone from auto-connecting to unknown Wi-Fi?
iPhone will only auto-join networks that are set to be joined automatically — it won't connect to any random network. SSIDs can be set to auto-join by being manually connected to in Settings → Wi-Fi in the past (the default is auto-join and you can tap the ⓘ to disable auto-join) or because of a profile installed on the device potentially by your carrier or workplace (accessed through Settings → General → Profiles).

You also might need to clean out the check mark to remember networks if you sync settings over iCloud. When one device remembers a network - it will sync to all devices and computers.