A
SIM card is a little chip that you can put in your phone and it stores your phone number in it and identifies with a provider. So no matter which cellphone you're using, if I dial your phone number, the cellphone with your
SIM card in it will ring

You can also store a certain number of contacts (name and number) on your
SIM card so if your phone dies on you one day and you backed up your phonebook on your
SIM card, you can recover everything when you get your new phone. But its main role is to identify your phone number on the networks.
Unlocking a cellphone... well, you could try to purchase an unlocked phone from a provider, though that will usually be quite expensive. Look into it, it's the easiest

Otherwise if you end up with a locked phone there are ways to unlock it by typing in a code, which depends on your individual cellphone handset unit itself. Basically you put your phone's make, model, serial number and service provider from whom you obtained the phone and plug into a 'calculator' of sorts and it gives you a code to plug into your phone. I don't have much experience with this, but there is a thread atop this forum which might help you out (for Nokia phones at least).
I'm not sure of the legality of unlocking your phone either. Anyone?