To unlock your iPhone from its carrier, you'll likely need to contact your carrier directly to cancel your contract.
Not sure if your device is ready for an eSIM? Here's how to check: If you see a section labelled Digital SIM or Add eSIM, ...