There are a couple of reasons carrier might lock their SIM.
- The original owner failed to comply with the terms of their contract with the carrier.
- The device was listed as stolen or lost and the carrier locked the SIM
- The carrier suspected fraud and locked the SIM
Settings->General->About-> scroll down to Carrier Lock and check for information. Also look for Network being used.
Bottom line, though, is that only the carrier can unlock the SIM. Apple will not assist you in any way.
So it looks like you purchased the iPhone XR from a third party and not an authorized Apple reseller. So are you willing to explain how you came to obtain the iPhone XR?