When and why did “mess” come to mean an untidy condition?
According to numerous dictionaries mess comes from the past participle of the Latin mittere meaning “to send”, because it was what was sent to the table.
Indeed, many uses of mess seem to jibe with this origin: mess of beans, mess hall, messmate, mess kit, and so on. The biblical mess of pottage has its own meaning; still it refers to Esau’s meal.
But the most common current meaning of mess appears to have nothing to do with food. So when and why, or at least how, did English mess come to mean “an untidy condition”?
Solution 1:
The answer lies in convergent evolution. These are not the same word, and merit two distinct entries in any dictionary worthy of that name.
The version of mess that derives from Latin mittere meaning to send or put (think English missive, mission, Mass) is today used mostly in a military context, but was once also used for Roman Catholic rite. The Wikipedia article says:
The root of mess is the Old French mes, "portion of food" (cf. modern French mets), drawn from the Latin verb mittere, meaning "to send" and "to put" (cf. modern French mettre), the original sense being "a course of a meal put on the table"; cfr. also the modern Italian portata with the same meaning, past participle of portare, to bring. This sense of mess, which appeared in English in the 13th century, was often used for cooked or liquid dishes in particular, as in the "mess of pottage" (porridge or soup). By the 15th century, a group of people who ate together were also called a mess, and it is this sense that persists in the "mess halls" of the modern military.
In contrast, the other word mess for, as you put it, an untidy condition, is more likely related to the verb to muss as in mussing up someone’s hair and may according to Wiktionary be a corruption of a Middle English verb mesh meaning to mash.