I don't know why you think swapping a SIM card would cause the contacts to go away. Contacts were kept on SIM cards decades ago but not now. https://support.apple.com/en-us/HT202340 Back up your phone regularly.What exactly are you trying to accomplish by unlocking this old phone? Are you trying to give the phone to someone so they can use it on a different network (other than AT&T), or something else? You can actually swap in a new SIM card (Google "how to replace the SIM card in an old iPhone") from a new provider, but there's a good chance you'll lose all of the contacts info from the old phone when you do this. That said, I wouldn't use an iPhone 5 nowadays due to the security & compatibility issues raised in the posts above. You're better off just buying a new iPhone 8 (the 6's and 7's are going to be sunsetted this fall as well). That's the least-expensive current model that allows for all of the necessary updates.