If you didn't remember your passcode to get into iPhone, you have to reset the passcode. There are a few ways to reach this aim. Check below steps to do that.
If you haven't synced your iPhone with iTunes before or if you haven't enabled your Find My iPhone on, you can take advantage of the third method. Resetting iPhone Password in Recovery Mode is not complicated. The steps below will show you how to do that.
Disconnect all cables from your iPhone and turn it off.
Press and hold the Home button and connect your device to iTunes. If your iPhone does not turn on, please turn it on manually.
Continue holding the Home button until you see the Connect to iTunes screen. iTunes will remind you that it has detected your iPhone in recovery mode.
Click OK. The Summary tab in iTunes appears. Click "Restore iPhone" and restore your iPhone.
Recovery Mode will erase all your data and passcode from your iPhone, resetting it to factory defaults. Thus, you'll have brand new iPhone without any personal data after you reset iPhone password with Recovery Mode. Therefore, please consider carefully whether you need to use this method to reset password on iPhone.
If you remember your current iPhone password and you just want to change into a new password, you can finish it with ease. Go to Setting > General > Touch ID > Passcode (iOS 9/8/7) or Passcode Lock (iOS 6), then enter the current password and tap Change Passcode. Then enter the new passcode. Now, you have reset your iPhone password.
For more methods, check: How to Reset Password on iPhone