Wikipedia actually has a page devoted to the 38-item-long list of possible etymologies of the word OK, so obviously its origin is somewhat under contention. While there have been roots proposed from Choctaw to West African to Greek, there is one theory that seem most likely. In the late 1830s, a slang fad originated in Boston, where people would ironically misspell words. One of the most whimsical of these alterations was oll korrect, but it would have died out with the rest if not for Martin Van Buren's 1840 re-election campaign. His slogan was OK Club, his voters being in the 'club' and his home, Old Kinderhook, NY, being the OK. It connected with his fans on a more personal level and was easier to say than Van Buren Club. However, it allowed the opposition in Boston to start jokingly calling it the oll korrect club, and, eventually, it lost the sarcastic connotation and started to just mean "good". Okay developed on a phonetic basis in the early twentieth centuries.
Adam Aleksic, a freshman studying linguistics at Harvard University, has been described as the internet's sixth most famous etymologist. He has disturbing interests in words, vexillology, geography, board games, limericks, and law, and he loves writing about himself in the third person.
The Etymology Nerd