To get the SIM unlock code, your T-mobile phone has to be under contract with T-mobile. They store that information and have a department that does the research to get the correct code for you. It is company policy not to unlock phones that are no longer under contract or phones that are on contracts newer than 90 days.
No other provider will have the information as it is company specific. Sometimes on ebay people sell codes to phones, but your best bet would be to buy a new phone that is already unlocked, or locked to your current carrier.