In these examples, "the" is on the boundary between a title and indicating uniqueness.
Bagheera the Black Panther (with the capitals) is indicating that there is only one Black Panther, and that it is Bagheera. Since it is from The Jungle Book, it might be that there is only one black panther that is in the area right now. Or that he is the only one who will be in the story, at least right now.
It has been a long time since I read The Jungle Book. But I don't think there were any other characters called Bagheera. So I don't think it was distinguishing which one was this particular Bagheera.
So being unique in some aspect becomes a sort of title. He is the black panther. The only one around. The author is using this to make Bagheera memorable. Whenever you read the name you will connect it to being a panther and all the characteristics of a panther.
With Alexander the Great it is somewhat different. In this case there may well be lots of other people called Alexander. It was not a rare name in the era that Alexander the Great lived. So adding "the Great" is a way of designating this particular Alexander. And, at the same time, paying respect to him.
So again, it is on the boundary of being a title and indicating uniqueness. This particular Alexander did many famous things. So that made him unique. And the phrase becomes a title.