Cedric Diggory gave Harry the clue to open the Golden Egg during the First Task of the Triwizard Tournament. He told Harry that he needed to take the egg underwater to understand the clue, as the mermaid's song could only be heard properly underwater.