The Upanishad uses as its base the story of Vajashravasa (वाजश्रवसः) and the Legend of of Nakiketas. Vâgasravasa, who was wishing for reward had sacrificed all his wealth. He had a son, called Nakiketas.
Nakiketas asked his father: 'Father, to whom wilt thou give me?' He said so a second and third time.
The father turned round and said to him: 'To Death, I give thee.'
Then a voice said to the young son, as he stood up: “He (thy father) said, ‘Go away to the house of Death’, I give thee to Death.” Go therefore to Death when he is not at home, and dwell in his house for three nights without eating.
If he should ask thee, “Boy, how many nights hast thou been here?” say, 'Three.' When he asks thee, “What didst thou eat the first night?” say, “Thy offspring.”
“'What didst thou eat the second night?” say, “Thy cattle.”
“What didst thou eat the third night?” say, “Thy good works.”