'What' is used for things. 'Which' is used for people.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
'which' selects; 'what' identifies.
So if you have a small number of choices, most likely even enumerated in the context, 'which' works better, and if you can choose from an enormous number of choices, 'what' is better.
— You can take aspirin or ibuprofen for your headache.
— Which is better? (You have selected one of the choices.)
—