Hey Lizzyrivera!
You stated in your post that you recently purchased an iPhone XR which is apparently Apple locked. Now this could usually be a few things. Firstly, the phone you purchased could be lost or stolen, and then put into Lost Mode by the proper owner. In this case, you won’t be able to unlock it for your own use. If there is a phone number displayed, I’d recommend calling it to get it back to its proper owner. You can read more about Lost Mode here. Another thing it could be is that the device is iCloud locked. In this case, before the seller sold you the phone, the previous owner probably forgot to remove the device from their iCloud account, resulting in a lock. This is a normal Apple security feature, and it’s quite common. However, the only way for you to be able to access it would be to get the owner’s original credentials and have them enter it and then remove the device from their account. Apple will not able to remove this, as they don’t have access to their customer’s information. You can read more about Activation/iCloud Lock here.
I hope you’re able to get your new iPhone working!
Chris