Two conditions: the phone has an eSIM chip, and it is unlocked (not tied to one carrier).
Is your phone compatible?
Checking your device…
*#06#
Not exhaustive and models vary by country: when in doubt, use the *#06# test.
iPhones bought in mainland China have no eSIM (except a few mini/SE models in Hong Kong and Macao).
Some US, Korean and Chinese variants have no eSIM.
Global versions only.
Many other phones support eSIM. Dial *#06#: if an EID number is shown, yours does.