Why would it be unlocked? If you upgraded an AT&T account it will be locked to AT&T.
And yes you have to activate on AT&T.
Apple clear states that you receive an unlocked iPhone when you use the iPhone Upgrade Program. That part I know for sure. But Apple also still makes you enter carrier information when ordering a phone with the iUP. It is implied that you must activate with the carrier you chose during purchase before you can switch to another carrier, but it isn't clear.
https://www.apple.com/shop/iphone/iphone-upgrade-program
On the main page for the iUP, they advertise:
"And if you ever decide to switch carriers after you activate your iPhone with AT&T, Sprint, T-Mobile, or Verizon, you can easily do that, too." - That seems to imply you have to activate with the carrier you chose first before you can switch it to another carrier, but it isn't clear whether you could just activate with another carrier from the get-go.
If you click on "How to Join" link, it also gives a bit more detail:
"
When I buy with the iPhone Upgrade Program, is my iPhone “unlocked”?
Yes. We’ll activate your iPhone on your choice of AT&T, Sprint, T‑Mobile, or Verizon, and once your new iPhone is activated, you can change carriers whenever you like. However, there are wireless network compatibility differences between an iPhone for AT&T or T‑Mobile and an iPhone for Sprint or Verizon."
Seems clear that they want you to activate on the carrier you chose first before you switch it to another carrier. And of course, you need to have the right version that supports the bands on a different carrier. I know that won't be a problem because I want to use the phone on another GSM carrier other than AT&T. I just didn't know if anyone has tried to activate on the "other" carrier first without activating on the carrier they chose during purchase first? It's not THAT big of a deal if that's what I have to do, but I'd prefer to just activate on the other carrier first and leave my current phone on AT&T (I have lines on two different carriers with two different phones).
This is probably a very niché question, so I wasn't expecting to get a clear confirmation. I guess I will just have to try activating with the sim from my other carrier first, and if that doesn't work, I'll activate on AT&T and then switch back to the other carrier. I just hope it doesn't try to lock to AT&T when I use their sim and then I'll have to call AT&T and tell them to unlock it since I bought it from Apple on the iUP.