The word "challah" is found in the Bible, and it refers to the showbreads that were displayed in the temple sanctuary and eventually eaten by priests. Around the 15th Century, Ashkenazic Jews in eastern Europe developed challah as it is known today.
When the Temple stood in Jerusalem, 12 loaves of bread, referred to as the Lechem HaPanim, continuously were on display. These loaves were baked by the priests and replaced each week to keep them fresh for Shabbat.
When the Temple was destroyed, the rabbis created symbolic rituals to preserve the memory of the Temple, one of which was called "hafrashat challah," or "the removal of dough." In this ritual, a small portion of the dough made for bread was separated and disposed of as a symbolic reminder of the offering of the Lechem HaPanim.
Challah as it is today was first created by Ashkenazic Jews in eastern Europe. It is thought that the braiding or twisting was a pun on twisting off the little piece of first dough as a reminder of the Temple sacrifices. The braided shape is believed not to be of purely Jewish origin but modelled after twisted white breads that were found through central Europe and the Slavic countries.