Unfortunately, these two words are frequently used interchangeably, but the English purist would define the usage of each as follows:
‘That’ is a restrictive pronoun. What this means is it should be used in sentences where the words following it are integral to the sense of the sentence. For instance, in the sentence, “The sweater that I bought had a hole,” the words ‘that I bought’ are necessary to identify which sweater we are talking about. It isn’t the one my mother gave me. It’s the one I myselef bought. Another clue is that there is no punctuation around ‘that I bought.’
The word ‘which’ is a nonrestrictive pronoun, and it is always preceded by a comma. The words after it can be eliminated from the sentence without changing the basic meaning. They are also followed by a comma. Here’s an example: “The garden tools, which Andrew gave me, are in the garage. At first glance you might think that ‘which Andrew gave me’ is essential information, but the writer indicates it is not by using ‘which’ and the commas. The essential information is that the garden tools are in the garage.
Generally, the writer of the sentence determines the specific meaning. If the writer felt that Andrew’s gift was significant, he or she would have written “The tools that Andrew gave me are in the garage.”
I hope this helps.