People frequently ask about the difference between that and which, and some situations can be puzzling.
Use that when you are distingushing one from others similar to it. When you write, “I own the blue car that is parked out front,” you are differentiating your blue car from the blue cars parked elsewhere on the street, in the parking garage, at the mall, or anywhere else. You are distinguishing the blue car you are referring to from all other blue cars.
Here is another way to consider it, a different way to say the same thing. The group of words “that is parked out front” is called an essential clause, because the words are essential to the meaning of the sentence. Removing those words would change the meaning. If you write simply, “I own the blue car,” you do not tell the reader which car you own because there are blue cars everywhere. “That is parked out front” differentiates the car you are referring to from all the others.
Use which (preceded by a comma) when there is only one or when the reader already knows the one you are referring to. For example, given that a company has only one headquarters, you would write, “My office is at Starbucks headquarters, which is in Seattle.” In contrast to the essential clause above (“that is parked out front”), the clause “which is in Seattle” is considered nonessential because those words are not critical to the meaning of the sentence. You could write simply, “My office is at Starbucks headquarters,” and the meaning would be clear, because there is only one such building, and most people know it’s in Seattle.
A tip that might help you is this: You don’t use a comma and which the first time you refer to something. Once it is clearly established in the reader’s mind the one you are referring to, either because you mentioned it in a previous sentence (using that) or because it is something widely known, then from that point on, you use a comma and which.
In fairness, English has always allowed us to use either which or that in a scenario such as the first one above, involving the essential clause. And some people still do, though more in academic writing. But through the centuries, it was always clear from the context that the writer was using which in place of that in that situation. Today, because many people don’t know the difference, when you see which in a sentence, you often don’t know without reading it twice whether the writer substituted which for that or whether the context calls for a comma and which but the writer forgot to insert the comma.