This article explains how to unlock the bootloader on an Android phone.
How to Unlock Bootloader on Android! [Android Root 101 #1]
Before you can actually unlock your phone, you need to enable the OEM Developer Unlock feature in Android.
Open the Settings app on your device.
At the bottom of the screen, you will see the Build Number. Tap it seven times to enable Developer Options. You may be asked to enter your password to continue.