If I switch the sim card from my phone to the iphone will it work as a t mobile phone?

My friend is going to sell me his iphone 5 for $50 but he has diffent company.

You can do something called "Unlocking" The phone which is where it was release your phone from your current company (So there it wouldn't be connected with any company) and then you can switch to a different company!

https://support.apple.com/...s/HT201328

The simple thing to do here is, to get this phone "unlocked". This will be more sensible if your friend has already finished the Service Contract with the company he was originally using the phone with.

He can simply call that company and ask them to unlock it. AT&T does it once the Service Contract is over. Check this with other companies.

There's another aspect that you should be careful about. If this is a CDMA phone then it will be a lot more difficult to unlock it and all that. GSM phones are much more easier to unlock. SPRINT / VERIZON and some affiliated Companies use CDMA phones. SPRINT will unlock their phones at the end of Service Contract but even then you can't use those Phones, if you are n USA.

If the phone is locked to that other carrier, then no. It would have to be unlocked.

If the phone is from a different carrier, you'll have to unlock the phone to get it work on T-Mobile or other carrier. If you need more info and help with getting the phone factory unlocked, mail me.