Almost every language has an O vowel, a K consonant, and an A vowel. So OK is a very distinctive combination of very familiar elements. And that's one reason it's so successful. OK stands apart.
Ordinarily a word so odd, so distinctive from others, wouldn't be allowed in a language to begin with. As a general rule, a language allows new words only when they resemble familiar ones.
Clever coinages may be laughed at and enjoyed, but hardly ever adopted by users of the language.
So it was in Boston, Massachusetts, USA, in the late 1830s, when newspaper editors enjoyed inventing fanciful abbreviations, like "WOOOFC" for "with one of our first citizens" and OW for "all right".
Needless to say, neither of these found a permanent place in the language. But they provided the unusual context that enabled the creation of OK.
On 23 March 1839, OK was introduced to the world on the second page of the Boston Morning Post, in the midst of a long paragraph, as "o.k. (all correct)".
How this weak joke survived at all, instead of vanishing like its counterparts, is a matter of lucky coincidence involving the American presidential election of 1840.
One candidate, Martin Van Buren, was nicknamed Old Kinderhook, and there was a false tale that a previous American president couldn't spell properly and thus would approve documents with an "OK", thinking it was the abbreviation for "all correct".