Short answer
Your phone must meet two conditions:
1. It supports eSIM technology.
2. It is unlocked for mobile service.
How to check on iPhone
Open Settings → Cellular / Mobile Data / Mobile Service.
Look for Add eSIM or Add Cellular Plan.
Open Settings → General → About and check Carrier Lock / Network Provider Lock.
If it says No SIM restrictions, your phone is usually unlocked.
How to check on Android
Android menus vary by brand. Try:
Settings → Connections / Network & Internet → SIM Manager / SIMs / Mobile Network.
Look for Add eSIM, Download SIM, or a similar option.
Quick check
Dial *#06# and check whether an EID appears. If there is no EID, the device may not support eSIM.
Important
Some phone models support eSIM only in certain regions. If you are not sure, contact your carrier or phone manufacturer and ask whether your exact model supports eSIM and is unlocked.