I'm confused at telling the difference in usage between the two words. If I say 'What do you want to be?", does it convey the meaning of an occupation or something about the character of a person? Even though I am not a native speaker of English, 'who do you want to be' sounds utterly wrong, as if it said 'what other person would you like to be'. So, what would you say 'What do you want to be when you grow up?' or 'Who do you want to be when you grow up?' What does your choice of this or that word depends on? Could you please clarify this choice to me? Every explanation is deeply appreciated, and a profound explanation is what I'm fervently looking for.
When we say "What do you want to be when you grow up?", we're usually asking about a profession, eg a teacher, or a police officer: this is not a person, so we use the impersonal "what". It doesn't need to be answered with a profession - they could reply "A caring, compassionate person", or simply "Happy", and this would be a valid answer. But, normally, we're asking about careers.
If you instead say "Who do you want to be when you grow up?", then you're asking about identity. This is not normally what you want to do. If they want to be a police officer, they don't normally want to be a specific police officer - they just imagine a more abstract idea of a general police officer.
Sometimes, however, someone might say that they want to be a specific person, if that person represents the role for them in some way. For example, someone might say "I want to be Taylor Swift when I grow up". This is a figure of speech - they don't actually want to change their name to Taylor Swift, and steal the successful singer's identity. They just mean that they want to be like that person: in other words, they're saying they want to be a very successful pop singer.
So, "Who do you want to be?", taken literally, doesn't really make sense. But, it can be allowed if it's taken figuratively to mean "Who do you want to be like?". The normal version of the question, asking someone about their career aspirations, would use "What".