There is little difference of meaning between which and what in most cases.
Which is the largest city in the world? OR What is the largest city in the world?
which / what color do you like?
Which people / what people have influenced you in your life?
Note that which is preferred when the speaker thinks of a limited number of choices.
We have got white and brown rice. Which will you have? (More natural than
what will you have?’. Here the number of choices is limited.)
Which teacher do you like best? (Limited because you can’t normally have an unlimited number of teachers.)
Which color do you want – white, black or brown?
Which language is the easiest to learn – English or German?
When the speaker has an unlimited number of choices in the mind, what is preferred.
What language do they speak in Albania?
What is your phone number?
When used with nouns, which and what can be used to talk about both people and things.
What writer do you like best?
Which color do you want – pink or purple?
Before a noun with a determiner (e.g. the, my, these etc.), we use which of. Note that what is not normally used with of.
Which of your siblings do you like best? (NOT What of your siblings do you like best?)
Which of these books are yours? (NOT What of these books are yours?)
When these words are used without nouns they act like pronouns. Note that in such cases who is used for people and which is used for things.
But note that which can be used in questions about people’s identity. In the same way, what can be used in questions about people’s jobs.
‘Which is your boy?’ ‘The one in the black shirt.’
‘What is your husband?’ ‘He is a teacher.’