I’m not a lexicographer, but that’s and when have straightforward meanings when put together. “That’s” is short for “that is”. That is a demonstrative, a word used to specify which thing is being referred to. “When” is an adverb referring to a certain time. When put together “that” is the noun in the sentence that refers to “when” something happened/is going to happen, etc.