Users can unlock the iPhone 4 through the cell phone carrier if the company allows it. If the carrier forbids unlocking or charges a penalty fee, then users may either pay the fee or jailbreak the phone by downloading a third-party app. A carrier unlock is safer than jailbreaking because it does not void the warranty or require users to download potentially harmful apps.
"Buying an unlocked iPhone 4 allows you to choose your own GSM carrier, change carriers at any time, and even use multiple carriers if you travel frequently," Apple points out on its unlocked-iPhone 4 page.
How to unlock iPhone 4 can only be done using GSM iPhone devices. This means that iPhones that do not support the ability to insert a SIM card (CDMA iPhones), cannot be unlocked.