How to unlock iphone 4 and switch carrier to tmobile?

I have an att iphone 4 version 7.0.2 i need to switch the carrier to tmobile. I've been trying to watch videos on how and have had no luck. Someone with a brain Please help me.

Added (1). my friend gave me the phone i'm not the owner. It went through the two year contract

You can check on youtube man!

AT&T will unlock it. Call them and they will send you the unlock code. Then you restore using iTunes to finalize it.

If you're the original owner of the phone and the phone has gone through the full 2 year contract and your account is paid in full, you can contact at&t and request that the phone is unlocked. Or you can do it online, search at&t unlock request on google.

EDIT: Your friend can do it, they just have to call. They'll need the IMEI number located in the phones settings under General and then About and the account number and they can fill out the form or call at&t. The form is called an unlock request form. It takes two seconds to fill out if you just ask them to do it, it's not a hassle. It usually takes 3-7 days after you fill out the form for it to officially be unlocked.

https://www.att.com/...ent/en_US/

^ There's a link to the form.
Send it to your friend with the IMEI number.

You are saying that you are not the original owner. In that case you can use a third party factory unlock, which is the same, but the only think that differs is that you would have to pay for it. For an old iPhone like this it would be around 20-30 bucks. Search on eBay or use the link below to use such service. I suppose that the original carrier of the iPhone is AT&T. If it is not the case you have to use a third party service for the original carrier of the phone.