Why? For the same reason I create so many female characters: at some point (much later, though) I felt that there weren't nearly enough in important, starring roles.
Whenever I think about it, I always flash back to those days when I was a little kid, and I used to put T-shirts over my head when I was play-acting to pretend I had "white girl" hair.
Because the concept of a black girl MC with 'black' hair simply did not exist, especially not in the magical girl genre I loved the most at the time.
Even now, I don't think things have changed much. =/ Name one magical girl character who is a black girl, from a show that isn't aimed at kids 5 and under. Even if she isn't the MC.
Personally, I am drawing a complete blank. All I can think of are maybe Connie from SU, and that blue-haired girl from that magical-girl parody show that no one liked...It's pathetic. There's no other word for it.
And honestly, it doesn't get much better even when you expand the search parameters to other genres, or even when you include black boys. When I think of powerful, youthful, dynamic characters that I would have imprinted on and loved as a child, they're invariably "Japanese" or straight-up white.
And unlike with the female MC thing, I don't feel quite as confident in my ability to "fix" that...especially since I'm still at a point in my life where I'm mostly refurbishing old stories I wrote as a kid (with the uninspired character demographics that go along with that...).
I'm always either 'black-washing' old characters or writing stories specifically for new characters of color, so it always feels gimmicky and weird...but I think if I just press on, I'll get to a comfortable place.
As for the how, I pretty much just explained it. ^^; But of course, there are always things that I try to avoid...like the "token diversity plotline" that unfortunately befalls a lot of characters of color these days.
I understand it in things like sitcoms that are mostly set in the real world, but when it comes to stories with lots of fantasy elements (90% of what I consume) I don't understand why I still have to see it.
Why are black characters constantly burdened with the responsibility of being mouthpieces for IRL social issues? Why can't they just exist as people, like everyone else in the cast?
A similar version of this is given to female characters with all those cringe "feminist" quips that writers throw in for 'woke points', often without even using them correctly ('mansplaining' is not just when a guy explains something; it has a specific context!!)...and consequently making a mockery of the issues they're supposedly trying to 'address'. But I digress...
Anyway, that's something I try to do; just give characters of color the right to simply exist in fantasy and sci-fi. They can have issues, sure, but personal issues written in a personal way, and not for the sake of teaching the audience a "very special lesson".
Some people might call it escapist, but I don't think imagining a world without racism is any more escapist than imagining a world without hunger, or war, or language barriers; and you see stuff like that all the time.
If you find giant space robots and magic spells more believable than a PoC living a happy life, I think you might be the one with issues that need examining, not me. =/