There are two types of relative clauses in English, which I shall call 'defining clauses' and 'commenting clauses'. They are best described with an example:
Pilots who have dull minds seldom live long
Pilots, who have dull minds, seldom live long.
The first sentence is a warning about the dangers of having a dull mind if you want to be a pilot. The second is insulting to all pilots.
Defining clauses are never separated from the main sentence by a comma: commenting clauses always are.
There's an old fashioned rule that you should always use 'that' rather than 'which' when you are writing a defining clause. Thus
Animals that lay eggs are called birds.
is grammatical, while
Animals which lay eggs are called birds.
is ungrammatical. These days, however, prescriptivism (language rules) is unfashionable and people are far more likely to consider both sentences to be grammatical, and to mean the same thing. Moreover, in colloquial speech, and even in writing, the rule has never been universally followed.
Of course, neither sentence is factually correct: a snake lays eggs, but is not called a bird!