A Connecticut Yankee in King Arthur’s Court, by Mark Twain, was first published in 1889. It was originally titled A Yankee in King Arthur’s Court.
In the novel, an engineer from then modern-day Connecticut is transported back in time to King Arthur’s court. He uses his knowledge of engineering to trick Arthur’s court into believing he is a magician (his feats of “magic” include a fireworks display). Since he knows the story of King Arthur, he hopes to prevent the events that lead to the death of Arthur and the destruction of Camelot. But he does not succeed.