Copyright isn't level legal vs illegal, it's infringing vs non-infringing. Fan art very often could be argued to be infringing, but no company has any reason to pursue it in the vast majority of cases, so they just don't.
It's very confusing, especially when you have to consider trademark as related but separate.