When it first appeared in English, mess meant a portion of food. This came from the Old French mes, �a dish�, which in modern French is spelt mets. This comes ultimately from the Latin missus, strictly �to put, send� but which could also mean �a course at a meal� (that is, something put on the table).
In the fifteenth century, mess came to refer to a group of people, usually four in number, who sat together at a meal and were served from the same dishes. This soon evolved into a name of any group that ate together. For example, in warships, a group of a dozen or so men would usually sit together at one table and were served from the same dishes; this was one mess, and those who habitually sat together were messmates; the room was often called a mess-room, a space that contained a set of messes. By an obvious process, mess-room was itself later contracted to mess, so confusing the place where one ate with the groups of people one ate with.
At one time mess could also refer to any cooked dish, especially one which was liquid or pulpy; this is best remembered in the mess of pottage for which Esau sold his birthright in the Bible (though the phrase doesn�t appear in the Authorised Version of 1611). The sense of a confused jumble or a dirty or untidy state, which is the first association we have for mess nowadays, evolved from this meaning and seems to have been a disparaging reference to such sloppy food. It is actually a very recent usage, dating only from the nineteenth century (it�s first recorded in Webster�s Dictionary in 1828).