If it's a passcode lock and you can't remember the passcode, you'll have to restore the iPhone as outlined here -> iOS: Device disabled after entering wrong passcode
If it's a SIM Lock and you can't remember the pin, you'll get three tries before you need a new SIM. You shouldn't have to restore, but if you do, you may be able to pop the SIM out and then restore the iPhone.
If you forgot (or don't know) your passcode, restore the device from backup on the last computer it was synced with when the passcode was turned on... this will remove the passcode. If you do not have access to the last computer it was synced with, you will have to force it into recovery mode & restore as a new device.
Press the home button for about 5 sec
Simultaneously press sleep/wake button
If the screen shows "slide to power off", press cancel and repeat again.
Until 10 secs then the iphone will go off completely without showing "slide to power off" screen
now leave the sleep button and keep holding home button
after 5 sec it will appear in itunes
and ask for restore