If yes,how to unlock my phone for using T-MOBILE?
Most likely, No. Verizon and Sprint use CDMA technology. This does not have a SIM card as the code is embedded in the phone. AT&T and T-Mobile use GSM, which has a SIM card. So can use an unlocked AT&T or other GSM phone on T-mobile and vice versa. You can use an unlocked sprint phone on verizion and vice versa. There are some additional compatability issue between the carrier such that you may not have all of the band available, which may result in not as good of coverage, but it should still work between the carriers with the same type of technology.
There are some versions of the phone that have a slot of a SIM card, which is designed to be used if you want to bring your phone overseas. It would probably work on T-Mobile, but you are only going to get 2G speeds.
You can get an unlock code from you carrier if you have paid the full price for the phone, or you have meet the 2 year contract requirements, or they are nice enough to give it to you. If you are a long time customer ans ask for the unlock code because you want to travel overseas, sometimes they will give it to you, sometimes not. Additionally there are third party sites that sell unlock codes (t-mobile as links for one of them if you follow the bring your own device link)
This question was answered in your other post. Check out Can I use my Sprint Galaxy S4 on T-MOBILE?How do I unlock my sprint galaxy S4 for T-MOBILE? .
Retrieving data ...