Welcome to Android Central! Some devices have an option to automatically turn on wifi if there is a signal nearby. My Razr Maxx has a setting under System Settings/Wireless & Networks/W-Fi called "Auto-Connect Wi-Fi (Allow Wi-Fi to automatically turn on)." Check your Wi-Fi menu to see if you have something similar.
Also, some carriers install their own feature, like a Wifi Optimizer, that allows this function as well. See if you have an app like that. What wireless provider did you get your phone from?