When my friends have grammar questions, they often ask me for help. I don’t consider myself a very good teacher of grammar, however, because the rules make sense to me more intuitively than logically. Sometimes, though, there are rules that make sense on both levels. The difference between “what” and “which” is one of these rules, as it is as straightforward as grammar rules come.
“What” is used for topics of unlimited or unspecified number. For example, if you knew that your friend heard live music last night, but you had no idea which band it might have been, you would ask him: “What band did you see last night?”
On the other hand, “which” is used for topics of limited number. For example, if you knew that your friend went to a specific live music event put on by three bands, you would ask him: “Which band did you see last night?”
The difference between the two is minimal, but precision makes your writing — and speech, for that matter — all the more effective.