AT&T SIM-locks devices to protect against fraud and minimize the chances of theft. This is what you need to do in order to unlock your AT&T phone:
Go to att.com/deviceunlock
Select Unlock your device, and follow the prompts
You can check your email or text messages for an update on your request―it usually takes only a few minuets for the approval, but it could take up to 48 hours. For a quick status check go to https://www.att.com/deviceunlock/status and follow the prompts.
Once your request is approved, check your text messages or email for instructions and an unlock code―iPhones don’t have unlock codes.