Are all iPhones bought at apple automatically unlocked?

My friend bought an iPhone 5s at apple and used it at Verizon. Can i use this phone at tmobile?

No, Verizon is a CMDA company, T-mobile is GSM
And Verzion typically has burnt in sim cards (the removable one is for internet, not phone calls)
There's a SMALL offset chance you can unlock the phone for "international use"and a SMALLER chance you can use a GSM SIM card

Yes as all iphones are gsm how it may not be unlocked

If you buy it straight from Apple and get the GSM version, yeah.

Phones bought at the Apple Store are fully unlocked if you don't buy a plan with them. Verizon requires a special version of iPhone, however, so you have to buy a plan with it.