In 1913, a character in Jack London’s The Valley of the Moon bitterly complains, “We’re hornswoggled. We’re backed to a standstill. We’re double-crossed to a fare-you-well”. Seven years later the young P G Wodehouse employed it in Little Warrior: “Would she have the generosity to realize that a man ought not to be held accountable for what he says in the moment when he discovers that he has been cheated, deceived, robbed — in a word, hornswoggled?”
By then, the word had been in the language with that meaning for more than half a century, and even then it had been around for some decades with an older sense of “embarrass, disconcert or confuse”. People had long since turned it into an exclamation of surprise or amazement: “Well, I’ll be hornswoggled!”
Peter Watts argues in A Dictionary of the Old West that it comes from cowpunching. A steer that has been lassoed around the neck will “hornswoggle”, wag and twist its head around frantically to try to slip free of the rope. A cowboy who lets the animal get away with this is said to have been “hornswoggled”. A nice idea, but nobody seems to have heard of hornswoggle in the cattle sense, and it may be a guess based on horn.
Nobody else has much idea either, though it’s often assumed to be one of those highfalutin words like absquatulate and rambunctious that frontier Americans were so fond of creating. It’s sad to have to tag a word as “origin unknown” yet again, but that’s the long and the short of it.