Let's look at an example:
(a) Tanya's car is the sixth one that is yellow.
(b) Tanya's car is the sixth one, which is yellow.
These have different meanings. The first tells you that we look for 6 yellow cars, and take the last of them. The second tells us that Tanya's car is the sixth in line, and that it also happens to be yellow.
In the first sentence, we use "that" because knowing the color is essential to finding her car. In sentence (b) we use "which" to introduce a clause containing some information we don't necessarily need to identify her car.
We use the word "that" when the information following it is necessary and we use "which" when the information isn't necessarily required to identify the subject in question.
Hope this helps!