This comes from the Greek word "kleion", which referred to a ball of thread that could be used to guide someone through a maze or labyrinth. The idea of using a thread to navigate a complex path is how the word came to symbolize a piece of information or a hint that helps solve a mystery or problem.
It wasn't until the 17th century that "clue" began to be used in its modern sense of a piece of information that helps to solve a mystery.