Only after unlocking the bootloader, you will be able to flash custom ROMs and root your Xperia ZL or Z phone. You will also be able to flash custom Kernels. Also, Sony gives early previews of their upcoming firmwares to those with unlocked bootloaders. Before you start, follow these steps.

bootloader unlock Xperia Z

1. Get the IMEI code for your Xperia Z or ZL. This is obtained by typing *#06# in phone dialer.
2. Download the fast boot package for the ZL and Z from here.
3. Get a Windows PC with USB cable
4. Power down your phone and keeping the Volume Up button pressed connect the USB cable to PC this will trigger FASTBOOT mode and windows will start driver installation, extract the above package and point the driver install to that location (usb_driver) folder
5. Once you get the drivers installed, disconnect cable and power on the phone.

bootloader unlock xperia zl

Here is how to unlock the Xperia Z and ZL.

Go to: http://unlockbootloader.sonymobile.com/ and read everything.
At the bottom click ‘Start Unlocking the Bootloader’
Quote:
First, you should confirm that it is possible to unlock the boot loader of your phone by checking the service menu. In your phone, open the dialer and enter *#*#7378423#*#* to access the service menu.

In your phone, tap Service info > Configuration > Rooting Status. If Bootloader unlock allowed says Yes, then you can continue with the next step. If it says No, or if the status is missing, your device cannot be unlocked.
after u have verified that u can unlock bootloader, scroll to the bottom of the page and click "Continue"
you will get numerous prompts, read all info and if u agree click on "Accept"/"OK"/"Proceed"
finally u will get a "Create Unlock request" page, enter your IMEI (sometimes the last digit needs to be removed for this to work), name and email address
You should now receive your unique unlock key via EMAIL, SAVE THIS KEY SAFELY
Extract fastboot_with_Android_USB_file.rar and open fastboot folder
Hold SHIFT and right click on the background of the folder
Select ‘Open command window here’
Connect your phone in fastboot mode (turn phone off, hold Volume UP button and plug in USB Cable) [make sure drivers are installed as explained above)
In the cmd windows type in fastboot.exe -i 0x0fce getvar version
If a value is returned (it will return 0.5), it means the phone is correctly connected
Type in fastboot.exe -i 0x0fce oem unlock 0xKEY and replace KEY with the key which u received earlier.
You’re device should now be bootloader unlocked.