1) Unlock first.
2) Take out the AT&T SIM.
3) Install T-Mobile SIM.
4) Turn on phone.
5) Test with T-Mobile.
The AT&T service is already activated on the day of purchase. The phone is activated when you turn the phone on. AT&T service activation and phone activation are two completely different things.
Thank you. This is great help. I now see the whole picture.
To All:
I just want to add a few data points about the purchase.
Day 1: Signed up for the credit card. Given the option to buy or shop later when the credit card arrives. I pick later.
Day 10: Credit card arrives. I activated the card and link it to my accounts.
Link to purchase AT&T phones showed up after about 30 minutes. I know this question came up a few times. I am going to edit/add to the wiki. (Initially, I was searching forever as to where this link was.)
Day 10: Bought a phone, sign up for AT&T service online.
Day 14: AT&T service activated that day per AT&T customer service. Note - if purchased in store, AT&T service is active before you leave the store, per AT&T customer service.
Day 15: Phone arrives. Requested unlock per wiki instructions. Received request confirmation immediately via email. In that email, it says to confirm request, which I did. Received the unlock codes about 5 minutes later (wiki said within 24 to 48 hours).
Later on Day 15, I inserted a non-AT&T sim, and unlock the phone.