Clew, a ball of thread, is Old English cliwen, and the labyrinth association enters through Theseus and Ariadne, referenced this way by Chaucer, who wrote of a clewe of twyne as a guide. The figurative sense of clue as guiding evidence is attested from the seventeenth century; the spelling clue follows in the eighteenth.
The tidy version credits Theseus for the detective sense in one step. The messier truth is that spinners and thread-work had been using clew for anything that guides a process for centuries, and the myth gave the everyday metaphor a famous illustration, not its birth.
Etymology enthusiasts note that clue, unwind, thread, and follow form a fossil kit of the labyrinth inside police procedural language: the detective is a Greek hero, the truth is the exit, and the minotaur is never mentioned.
We still say we are unraveling a case and following a thread without remembering that the metaphor once had a monster at the end of it. Should it?