If you've forgotten your iPhone passcode, you can use iTunes to erase it from your phone, along with all your data, and restore it to a backup later. The password will be removed during this process, allowing you to register it again. You can also use Siri to bypass the lock screen; please be aware that this procedure is illegal when performed on an iPhone that is not yours. Also note that using Siri to bypass the iPhone lock only works on iOS 9, and this is subject to change; as with any method that circumvents the iPhone password, this flaw is unintentional, so it can be corrected by Apple at any time.
Steps
Method 1 of 2: Bypassing the lock screen on iOS 9.2.1

Step 1. Make sure you have the correct iOS version
Such method does not work on iOS 9.3 or higher version. It is possible to downgrade iOS if you want to jailbreak the iPhone, but be aware that doing so may violate Apple's warranty.

Step 2. Check if the iPhone is really locked
This method does not disable the passcode, so you will still need to perform an iPhone restore to permanently remove it.

Step 3. Press and hold the "Home" button for two seconds
This will activate Siri.

Step 4. Ask Siri the time
This should open the clock icon with local time.
Siri answers the "What time is it" question better than other variations such as "What time is it now"

Step 5. Tap the clock icon
This will redirect you to the "World clock" menu.

Step 6. Tap the "+" sign
It is usually found in the upper right corner of the screen.

Step 7. Type some characters into the search bar
The search bar is located at the top of the screen. These characters can be random - you just need to be able to select them to copy them.

Step 8. Tap and hold the search bar, then release it
This should highlight the text.

Step 9. Tap on the text again and select "Copy"
This will copy the selected text, making it available for later pasting.

Step 10. Tap the arrow to the right of "Copy" and then tap "Share"
This will open a menu with various sharing options.

Step 11. Tap on the "Message" option
This will open a new message window.

Step 12. Tap and hold the "To" field and select "Paste"
The "To" field is at the top of the screen.

Step 13. Wait two or three seconds and press the "Start" button
This will minimize the "iMessage" window, taking you straight to the home screen. You have now successfully hacked the lock screen on your iOS 9.2.1 device!
Method 2 of 2: Formatting and Restoring Your Device with iTunes

Step 1. Connect iPhone to computer using a USB cable
The USB end of the cable - the larger part - should plug into your computer, while the smaller end should plug into your iPhone.
Although you can use a USB charger, use the original cable in this step for best results

Step 2. Open iTunes on your computer if it doesn't open automatically
Depending on your computer model, you may need to confirm opening iTunes after connecting your iPhone.

Step 3. Wait until iPhone syncs with iTunes
The bar at the top of the iTunes window should display the following message: "Syncing [your name]'s iPhone (Step [X] of [Y])". At the end of synchronization, you can start the restoration process.

Step 4. Click the "Device" icon to open the iPhone's "Summary" tab
This icon resembles that of an iPhone, and is located under the "Account" tab.

Step 5. Click "Backup Now" under the "Backups" section
While this is optional, doing so ensures that your data is as up-to-date as possible when restoring from a restore point.
- If automatic backup is turned on, you don't have to do it again-iPhone will do this as soon as it's connected to your computer. Check the date of the most recent backup under the "Backup" section to confirm that your phone's data is saved.
- When backing up your phone, you can choose the option "iCloud" (to save the files to your iCloud account) or "This computer" (to save the data to your local computer).

Step 6. Click "Restore iPhone"
This option is found at the top of the "iTunes" page.
If "Find My iPhone" is turned on, iTunes will ask you to turn it off before restoring. To do this, open the "Settings" app, select "iCloud", tap "Find my iPhone" and slide the "Find my iPhone" switch to the right to disable this function. You may need to enter your iCloud password to complete this process

Step 7. Click "Restore and Update" to confirm your decision
To let you know what happens when restoring iPhone, read the information in the pop-up window before continuing.

Step 8. Click "Next" and then "Agree" to start the restoration process
This means that you accept Apple's terms and conditions of use for the software.

Step 9. Wait until the restoration is complete
This procedure can take several minutes as iTunes will erase and reinstall iOS on your phone.

Step 10. Select the restore point from the "Restore from this backup" option
To do this, click on the bar with the name of your iPhone. The date and location of the selected backup will be displayed below this bar; choose the latest option for best results.
Click on the circle next to "Restore from this backup" to enable it if it is not the default option

Step 11. Click "Continue" to start the restoration
iTunes will begin restoring iPhone. You will see the message "Time Remaining" at the bottom of the restore pop-up window.
The total restore time may take a while - typically 20-30 minutes - depending on the amount of data stored

Step 12. Swipe your finger over the "Swipe to unlock" message on the iPhone screen
This will unlock your phone; please note that you will not need to enter the access code!
You can create a new passcode at any time in the "Passcode" tab in the "Settings" application

Step 13. Enter your Apple ID when prompted
This will restore the iPhone and its data. Be aware that it will take a while for iPhone apps to update and are ready to use.
Tips
- If you don't remember your Apple ID password, you can reset it on the iCloud website by clicking the "Forgot your password?" and following the instructions on the screen.
- So that it is no longer possible to bypass the device lock without an access code, create a password for Siri in the "Access Code" tab in the "Settings" application
Notices
- If you don't have any existing backups before restoring, you won't be able to recover your data.
- Starting with iOS version 9.3.3, it is no longer possible to use Siri to circumvent iPhone access without a passcode.