Kali Linux is an operating system just like any other operating system like Windows but the difference is Kali is used by hacking and penetration testing and Windows OS is used for general purposes. Kali Linux OS is used for learning to hack, practicing penetration testing. Not only Kali Linux, installing any operating system is legal. It depends on the purpose you are using Kali Linux for. If you are using Kali Linux as a white-hat hacker, it is legal, and using as a black hat hacker is illegal.
If you are interested to learn Linux, I recommend this Linux Course by Intellipaat.
You can watch this video on Kali Linux to understand more about Kali Linux: