Thants, all the info on wi-fi can be read here:
Wi-Fi - Frequently Asked Questions - iPhone - O2
If you're in a wi-fi hotspot the phone automatically picks the signal up and you get the faster browsing speeds. If you're not in a wi-fi area you use the fastest available data connection, either HSDPA, 3G, EDGE or GPRS.