'that' instead of 'which'

There she discovers that her uncle Gordon, who lives in South America, has sent her a small box which she is only to open if in trouble. Jane, whose parents have never mentioned an Uncle Gordon, is suspicious of the box, which she gives to her to her friend Tony.

why can’t I say ‘that’ instead of ‘which’ in above sentences?

Thank you very much.

These are non-defining clauses, which generally work better with “which”. Many people would probably find “that” tolerable in the first sentence, but it seems more wrong in the second. Probably this is because the second clause is more strongly non-defining, as emphasised by the comma. Also “the box that” is more strongly defining than “a box that”.

(In case it matters, there is a typo “to her to her” in the second sentence.)