The word which can be used to introduce both restrictive and nonrestrictive clauses, although many writers use it exclusively to introduce nonrestrictive clauses; the word that can be used to introduce only restrictive clauses.
Think of the difference between
"The garage that my uncle built is falling down."
"The garage, which my uncle built, is falling down."
I can say the first sentence anywhere and the listener will know exactly which garage I'm talking about — the one my uncle built. The second sentence, however, I would have to utter, say, in my back yard, while I'm pointing to the dilapidated garage. In other words, the "that clause" has introduced information that you need or you wouldn't know what garage I'm talking about (so you don't need/can't have commas); the "which clause" has introduced nonessential, "added" information (so you do need the commas).
Incidentally, some writers insist that the word that cannot be used to refer to people, but in situations where the people are not specifically named, it is acceptable.
The students that study most usually do the best.
But we would write "The Darling children, who have enrolled in the Lab School, are doing well."