It is connecting to unknown WiFi because you have asked it to! When you configured your phone you enabled the Wifi sense and share/connect to networks.
Goto Setting-> Under Network+wireless -> WiFi -> Scroll down to [WiFi Sense] - > Disable connect to WiFi hospots -> Uncheck "Accept terms of use for me when required" , Uncheck "Provide my name,email address or phone number when required", Disable - Share WiFi networks I select on uncheck Outlook, Uncheck Skype, uncheck facebook.
Done! This all you selected when you initially configured phone without reading it :wink: