You contact the carrier with which it currently has an account, or you buy the unlock code on eBay. When you put the local SIM in, it will ask for the code. Put it in and the phone is unlocked. (No guarantee that you'll get anything faster than 2G data, though. That depends on what frequencies the local company uses.)