Check below to see if you meet the unlock requirements. If you do you can call customer care to submit a request.
If you don't, you will need to buy an unlock from services online that sell them. Or you can contact the location your bought it from to see if they can get you an unlocked one.
Manage your T-Mobile account