Ornery is ordinary, said fast. The insult began as a regional American way of pronouncing one of the plainest words in the language.
Merriam-Webster calls ornery simply an alteration of ordinary. It appeared in American regional speech in the early 19th century and at first meant the same thing. Anne Curzan, an English professor at the University of Michigan, and her co-host Rebecca Hector explain on Michigan Public that something could be called "ornery-looking," meaning ordinary-looking.
The trouble was that ordinary already had a low side. By the 1600s, they note, it could refer to commoners, or to people considered unrefined. Something ordinary could also be poor in quality. Ornery inherited those senses. They quote an 1816 description of farmland: "The land is old, completely worn-out, the farming extremely ornery in general." The farming was not average. It was bad.
From there, the word attached itself to people and kept sliding. Merriam-Webster's word history moves it from inferior quality to "lazy," then to touchy and easily annoyed. Its first known use in the sense of "irritable" is from 1849. By the end of the 19th century it had settled into its modern meaning, cantankerous.
The dating has a wrinkle. Wordsmith.org gives an earliest documented use of 1692, well before the American record. The other sources here place the word's growth in 19th-century American speech, which is where most of the evidence is.
Ornery has not finished changing. Merriam-Webster lists a chiefly Midwestern sense, "mischievous," for someone with a playful tendency to cause trouble. The two hosts report hearing it pronounced "ORN-ree," "ORE-ner-ee" and "AWN-ree."
The word belongs to a small group of everyday words reshaped by pronunciation. Wordsmith.org grouped it with passel and sassy in a week of "words formed by dialectal pronunciation." Merriam-Webster points out that dropping an "r" sound in the middle of a word gave English cuss from curse, bust from burst, and passel from parcel.
Each started as a casual way of saying a word and ended up as a word of its own. Ornery is the one that also picked up a temper.