This paradox was created by Miguel de Cervantes in his book Don Quixote of La Mancha.
Sancho Panza, Don Quixote's faithful squire, becomes governor of an island with a very curious law. The island keeper should ask each visitor the reason for the visit. If the visitor answers the truth, that's fine. But if he lied, the visitor would be hanged.
The problem is that one fine day came a visitor who replied that he was visiting the island to be hanged! And now? Should the visitor be hanged or not? If they had not hanged him, he would have lied: so he should be hanged. But if they hanged him he would have spoken the truth and should not be hanged. In Cervantes' story, the governor is kind and frees the visitor.