Any working cell phone is locked to one degree or another. As long as a cell phone is attached to a wireless network, it is attached to, or locked, to that network. Unlocking a phone allows it to be used on other wireless networks or to be sold, recycled, etc. When a phone is marked as stolen, or if an owner has tried to enter an unlock code too many times, that phone is hardlocked so that it cannot be unlocked at all or without specific intervention of the phone's wireless provider.
Contact customer service of the phone's network provider. Typically this company's name will be written on the phone itself. Tell them you wish to unlock a hardlocked phone.
Answer the provider's questions about the phone. These will include its serial number as well as personal information to determine your ownership and the reason the phone was hardlocked.
Follow the provider's instructions. If the phone can be unlocked, send it to the provider to be unlocked using an "unlock box." This device reprograms elements of the phone's software with new unlock coding. This cannot be performed remotely.
Some third-party services such as cell phone dealers not associated with a particular network or cell phone websites can provide unlocking services. But these services can be more expensive and less trustworthy than dealing directly with the phone's wireless provider.
Some hardlocked phones simply cannot be unlocked because of their history or because of problems with the phone itself.