There are instructions with the new sim, you have to send a text via the old sim to a certain number before you put the new one in
If you bought the phone from Apple, sim free then it can't be locked to any provider. I recently got an iPhone and put the virgin sim into it and it worked for a couple of minutes. Phoned Virgin I was told the local mast was down, but no matter where I went, not local, it wouldn't work. Eventually got a new sim and had to phone CS to activate it and then it worked.