Short answer
An unlocked phone can use mobile plans from different providers. A carrier-locked phone may block eSIM installation or connection, even if the phone supports eSIM.
How to check on iPhone
Open Settings → General → About → Carrier Lock / Network Provider Lock.
If it says No SIM restrictions, your phone is usually unlocked.
If it shows a carrier lock, your phone is restricted by that carrier.
How to check on Android
Android menus vary. Check SIM Manager / Mobile Network / Network settings, or contact your current carrier.
Important
If your phone is carrier-locked, only your carrier can remove the lock. This is a device/carrier restriction, not something the eSIM app can remove.