Very nice. I'll try to explain exactly what happened.
Two possible scenarios:
1. Buy an iPhone at a retail location (AT&T or Apple Store). The phone when you connect to iTunes asks you to either set up a new account, or to put in your existing phone number. You can easily type your existing phone number, activate the iPhone, then go sim swapping crazy.
2. Buy an iPhone from Apple online. For some weird reason, who knows why, Apple registers the IMEI of the phone for both iTunes and in your AT&T account. When you connect the iPhone to iTunes it automatically pulls up your existing phone number, the account number, and other information it gets from your account from AT&T. If you were shipped the wrong phone for whatever reason, the number you see there will be someone else's number.
In situation #2, the phone can't be activated because you need to provide proof you are the owner of the account. I believe you need the SS# on the account. Since you aren't the other person, you can't activate the phone. Put in another SIM, connect to iTunes, iTunes uses the IMEI of the phone to lookup info on the phone, and once again presents you with the other person's account info and wants you to verify.
Also in situation #2 if you take it to an AT&T store, they can see the IMEI of the phone on the account, but if they try to remove it they get an error that it is locked. Call Apple for help, they will only offer a return and replacement for a solution.
Sorry that you don't believe it, but that is the way it works, but it only on the iPhone, no other manufacturer does this. Typically, yes, a sim swap would work, but not in above situation #2.