Yes. However, only the carrier can unlock your iPhone. You can reach out to them to request an unlock. Check out Apple's support page on unlocking your iPhone.
Once your iPhone is unlocked, you can get a prepaid or postpaid plan from the carrier of your choice and use SIM cards and eSIMs in other countries, which eliminates the need to enable data roaming that costs more.