No, penetration testing and Kali Linux are not illegal at all. Kali Linux is used by security researchers and other people in the web field for testing and trial purposes.