“That” introduces a restrictive clause---a clause that must be there for the sentence to make sense.A restrictive clause often defines the noun or phrase preceding it.”Which” introduces a non-restrictive,parenthetical clause---a clause that could be omitted without affecting the meaning of the sentence.
Example
The car was travelling at a speed that would endanger lives.
The car, which was travelling at a speed that would endanger lives, swerved onto the sidewalk.
------------------------------------------------------------------------------------------------------------
Use “who” or “whom” , rather than “that” or “which”, when referring to a person.