In simple words – a black hat hacker is a bad guy, while the white hat is good. Both parties penetrate systems. Still, the first has malicious intentions for hacking the system, while the latter does the same to improve its security.
Generally, the law and the hacker’s motivation define what a white hacker is. Still, in some countries, the boundaries between white and black hats are a bit hazy.