Use which when a sentence could stand alone without what comes after the word:

She went to the grocery store, which wasn’t her favorite thing to do on a Friday afternoon.

Use that when a sentence needs what comes after the word.

Gorillas that eat lettuce are stronger than those that don’t.