To unlock your iPhone from its carrier, you'll likely need to contact your carrier directly to cancel your contract.
If you need to find out your iPhone's carrier without a SIM card installed, you can do so through the Settings app.
A user has an iPhone 3G from a relative in France. Has the phone, but no SIM card. Can't activate it initially because he has T-Mobile, so no valid SIM at all. I can't even use an ATT SIM (in US) so ...