"Which" is used when a person is making a choice between just a couple of options. "Which shoes should I buy?" (The speaker is probably trying to decide between two or three pairs.)
"What" and which can both be used when there are too many choices to list.
For example, in English we would say,
"What city are you visiting when you go to California?"
But I believe in Spanish, you would have to say, "Cual cuidad ...."
"What" is also used when the answer isn't related to a set of choices. For example, "What did John say to you just now?"
"What" is used much more often than "which."