Do you mean unlock for use with a different provider or to unlock the pin on the sim card?
If it is the pin for the sim you call your current provider.
If to unlock the phone to use with another provider that is somehting that can be gotten from t-mobile depending on where you got the phone.
If you bought it full price from t-mobile or a approved reseller you should be able to fax them proof of purchase and be good.
You can read about the requirements that are needed for t-mobile to unlock it here:
If you don't meet them there are numerous companies that sell unlock codes you can get.
Sorry to hear that; it seems like your phone is locked to work on T-Mobile's network, and unfortunatly will not work if you place another SIM card in the phone. Depending on how you got the phone (whether from a T-Mobile retail store, online, or you just bought it from someone) it may or may not be unlocked. Please call T-Mobile @ 1-800-T-MOBILE and a represenative will be able to tell you whether the phone may be unlocked.