The word diet used to mean the food and drink that we habitually consume did not appear in English until the thirteenth century, but it also had another sense, meaning “a way of life.”
The second meaning is more in line with the word’s origins, as it comes from the Greek diaita via diaitan. Diaita was a noun that meant a way of living, and also had a more specific meaning, signifying a way of living as advised by a physician, which could include a “food” diet and other daily habits.
The Latin Diaitan was a verb that meant “to lead, govern, or arbitrate one’s life.” The Latin word diaeta came from these roots. This word described a dietary regimen, as well.

In the Middle Ages, diet more often had this connotation of a dietary (or other) regimen prescribed by a doctor. Such “diets” were often fasts of one kind or another so that diet usually referred to a confined and regimented way of eating done for a specific purpose.
This sense, of course, survives in the popular use of the word “diet” to describe a way of eating specifically done to achieve a weight loss goal.
A way of eating was not always the only thing the word diet could refer to. Another, unrelated word diet came from the Medieval Latin word dieta, which could be used to refer to a jay’s journey, or work, or wage. It was also used for a particular day which was set for a meeting or assembly. For example, when the councilors of the Holy Roman Empire met in assembly, this was called a dieta.
One such assembly held in 1521 is quite infamous and is called the Diet of Worms, held in Worms, Germany. The important Protestant reformer Martin Luther attended this diet and was pronounced a heretic. Some sources attest that this version of the word comes from the same Greek and Latin roots, but it is likely to have derived from Latin dies, meaning “day.”