Whether your phone is locked depends on where and how you bought it. Phones purchased outright and unsubsidized are usually unlocked; phones from carriers on installment plans or contracts are often locked to that carrier until paid off or until you request unlocking. Some countries banned carrier locking entirely, so it also depends on your home market.
Checking is easy. On most phones, the settings menu shows lock status: iPhones display it under the about or carrier lock section, and many Androids show it in settings or via the carrier's app. The definitive test is borrowing a friend's SIM from a different carrier; if it registers on the network, you're unlocked. For eSIM-capable phones, trying to add a travel eSIM will similarly reveal restrictions.
If locked, contact your carrier before traveling: unlocking is typically free once the device is paid off, done remotely, but can take a few days to process, so don't leave it to the airport. Avoid third-party unlocking services; the carrier route is legitimate and safe.