The rule on when to use which or that is the hardest rule to remember in all of English grammar. I'll confess: I never learned it until I started teaching English as a second language. And I still have never met a native speaker of English who could tell me, confidently, when to use which and when to use that.
Here's the official rule: You use which with nonrestrictive clauses. You use that with restrictive clauses.
Yeah, I know. Doesn't really help much, does it?
Here's a simpler way to think about it. Take the clause you're doubtful about, and remove it from the sentence. If removing the clause changes the meaning of the rest of the sentence, you must use that. If removing that clause doesn't change the meaning of the rest of the sentence, you should use which.
Some examples:
Vegetarian food, (which/that) is becoming more and more popular these days, is easy to prepare.
Take out the clause and you're left with Vegetarian food is easy to prepare. The clause which is becoming more and more popular these days doesn't affect the meaning of what remains. This is a textbook non-restrictive clause. Therefore you must use which.
Vegetarian food (which/that) is organic and ethically grown tends to be expensive.
Here, the clause does impact the meaning of the sentence. You can't just get rid of it, because the clause specifies the kind of vegetarian food (organic and ethically grown) we're talking about. This is a textbook restrictive clause, and you must therefore use that.
In other words, a restrictive clause "restricts" the meaning of the sentence. A nonrestrictive clause doesn't.
Finally, you'll notice one more nuance: non-restrictive clauses tend to be set off by commas, whereas restrictive clauses tend not to need commas. Another clue to help you.
Once again, here's your easy rule on which and that: take out the clause. If it changes the meaning of what's left, use that. If it doesn't, use which.