This is a slightly complicated topic. For more information, search for "restrictive and nonrestrictive clauses."
To get a rough idea of the difference, look at these sentences:
A: I like cakes, which my mother bakes.
B: I like cakes that my mother bakes.
Sentence A has a comma. That means that the basic sentence is "I like cakes." The thing that I like is "cakes". If something is a cake, then I like it. Then, I give you some extra, additional information: my mother occasionally bakes cakes.
Sentence B doesn't have a comma. The thing that I like isn't "cakes", it's "cakes that my mother bakes".
I like cakes that my mother bakes, but I DON'T like cakes that my aunt bakes, and I DON'T like cakes that YOUR mother bakes.
If there is a comma, you can erase everything after the comma, and the basic meaning of the sentence will remain the same. This is called a "nonrestrictive clause". AFTER A COMMA, YOU *HAVE TO* USE "WHICH". IT IS *WRONG* TO SAY "THAT".
If there isn't a comma, the information after "which" or "that" is a NECESSARY part of the basic meaning of the sentence. If you erase it, you change the basic meaning of the sentence. IF THERE ISN'T A COMMA, "WHICH" AND "THAT" ARE BOTH OK, BUT "THAT" IS BETTER.
****In your sentence, there wasn't a comma, so it was a restrictive clause, and "that" was a better choice than "which". "Which" wasn't wrong, but "that" was better.
Let me give you another example:
A: This is the office building, which has two lunch rooms.
B: this is the office building that has two lunch rooms.
In sentence A, there is only one office building. I would say: "Welcome to my small town. this is the school, which was built in 1880, and this is the church, which is made of stone, and this is the office building, which has two lunch rooms."
In sentence B, there are several office buildings, and I am identifying one of them. "Don't take this letter to the office building that has three lunch rooms--take it to the one that has two."