If you are trying to unlock your phone for use with a different carrier refer to this link
How to unlock your iPhone for use with a different carrier - Apple Support
if your iPhone passcode is locking you out refer to this.
https://support.apple.com/en-us/HT204306
if you purchased or was given a second hand iPhone the owner of the phone needs to do these steps in order for you to be able to use the device. Apple can not assist you in this event.