What I mean is that if you've actually read instructions for rooting with stuff like Magisk you will surely have come across a description of how to unlock the bootloader (unless you've only read the magisk install instructions themselves, which assume that you have done that).
It's years since I did such things, so don't have everything to hand. But basically find and install "fastboot", which is a command line tool (precisely how will depend on what OS you use: I've done this with Linux and MacOS, but it's also available for Windows). Then you boot your phone into fastboot mode ("download mode" on some phones), which is done by rebooting while pressing some combination of buttons (which depends on the phone), though you can probably also use USB debugging to do this. Connect it to your computer via USB, check that the connection is working using the command "fastboot devices", and if that responds with the phone's serial number the command is something like "fastboot oem unlock". This is all from memory, so do check before doing anything, but there should be enough pointers there to find what you need.
Fastboot is also needed for magisk installation (you will see commands like "fastboot flash boot" mentioned).
Two things to note:
1) unlocking the bootloader will wipe the phone, so back up anything important first.
2) Many mods, such as custom ROMs or recoveries, are specific to a particular model of phone. Trying to install such software built for a different model of phone will end badly (for your phone it might actually be the end). So if you want anything like that, make sure it is available for your model before you bother unlocking.
In fact my general advice with this is (1) know why you are rooting, i.e. what you want to be able to change & what might stop working, before you do anything, (2) find all of the tools and software you need before starting the process, and (3) know what you will do if something goes wrong (e.g. can you find the official software for the phone and the tools needed to install that?). I'd usually say that a custom recovery is key: that's the simplest way to flash most mods (fastboot can only overwrite an entire partition, not make changes to little bits within one), and it allows you to back up the ROM and kernel before making changes (and hence allows you to recover if something goes wrong during any of that). But of course if you are trying to mask the fact that you have modified the software so that some media or banking app will still work a custom recovery may complicate that (I've never tried masking it). The key thing is that if you have neither a custom recovery nor a stock firmware package then you are basically screwed if the slightest thing goes wrong, and you should be particularly careful in this case.