Trophonius (Ancient Greek: Τροφώνιος) was a Greek hero, daimon, or chthonic god — antiquity never settled which — with a famous oracular cult at Lebadea in Boeotia. Son of Erginus of Minyan Orchomenus in the Homeric Hymn to Apollo (or of Apollo himself in Pausanias), he built Delphi's temple with his brother Agamedes and, in another strand, Hyrieus' treasury before the earth swallowed him. To "descend into the cave of Trophonius" became proverbial for suffering a great fright.
Adapted from Wikipedia, "Trophonius" · CC BY-SA 4.0
I.Family and the temple at Delphi
The Homeric Hymn to Apollo makes Trophonius and Agamedes sons of Erginus, king of Minyan Orchomenus, and builders of Apollo's temple at Delphi. Pindar (via Plutarch) and Cicero tell that after the work the oracle promised them whatever they wished for a few days and then their reward — and they were found dead, a tale linked to the maxim that those whom the gods love die young. Pausanias instead names Apollo as Trophonius' father.
II.Treasury and the Lebadean oracle
In Pausanias' other myth the brothers build a treasure chamber for King Hyrieus with a secret entrance; caught stealing, Agamedes is trapped and Trophonius cuts off his head so the body cannot be identified, then is swallowed by the earth and becomes an immortal subterranean power. The cave was rediscovered when plague-struck Lebadaeans followed bees into a hole and found the neglected daimon.
Pausanias (9.39) describes the consultation: days of purification in the house of Good Fortune and the Good Daemon, baths in the Herkyna, sacrifices to Cronus, Apollo, Zeus, Hera, and Demeter-Europa, a ram cast into Agamedes' pit, drinks from Lethe and Mnemosyne, and a descent into the chasm. Most worshippers emerged terrified; priests seated them on the chair of Mnemosyne and shaped an oracle from their ravings.