nandohyphen1 How exactly does the SIM lock work and why would someone use it?
The SIM card is a smartcard, similar to your debit card or credit card. The chip pretty much works the same. The SIM card will sign statements to prove identity, so you can authenticate to the network that you are permitted to use the network. But the SIM card will refuse to do this, unless the SIM card is provided the correct PIN code, which has to be entered on the device the SIM card is currently plugged into. Same as your debit card or credit card.
As for why? Because I don't want someone who has stolen my SIM card or phone with SIM card in to be able to purchase things such as internet services or paid phone calls, that gets automatically billed on my account. Exactly the same reason I want to have a PIN code on my debit card.
A PIN code probably does not matter much for pre-paid SIM cards that are not connected to any bank account, other than that someone who has your SIM card can send SMS messages claiming to be you. But for subscription based SIM cards, you very much would want to have a PIN code.
nandohyphen1 So if I locked my SIM and put it in a brand new phone, my SIM would still have the lock on it and I'd have to enter the PIN to unlock it on the new phone?
Yes.