In the early Middle Ages, law was taught by the clergy, but Pope Honorius III in 1218 forbade the clergy to practice civil law. Then, in 1234, Henry III forbade law schools within the London city limits. Laymen interested in teaching law moved outside London and looked for buildings or collections of buildings to buy or rent, and the guilds in which they worked evolved into the Inns of Court. Four Inns exist: The Honorable Societies of Lincoln's Inn, the Inner Temple, the Middle Temple, and Gray's Inn. They truly were inns, because students lived as well as learned there. They are all near each other.
Although Lincoln's Inn claims the earliest records going back to 1422 (incidentally, the picture above is the Lincoln's Inn library) we know that lawyers lived in the Temple as early as 1320, though not as teachers. In 1337 the place was divided into the Inner Temple, and the Middle Temple (as distinct from an Outer Temple that existed). By 1388 they were two distinct groups. In 1620, a meeting of senior judges decreed that all four were considered equal in order of precedence, regardless of when they may have been founded.
Like the seven subjects of the University curriculum, law students were expected to spend seven years learning the law, mostly by attending court and asking questions afterward. Their experience included dining communally with practicing barristers for networking and additional knowledge. It wasn't until the mid-18th century that common law became. subject for study in universities.
The Inns of Court recognized three levels: student (learning law), barrister (practicing law), and master of the bench (called "bencher"). Benchers were senior members of the Inns, and could be appointed by existing benchers when still a barrister. An appointed High Court Judge was automatically a bencher. Benchers were the governing body of their respective Inn. Their duties were to admit students, "graduate" students, and appoint other benchers. One bencher was appointed Treasurer for a term on one year.
But I know the question nagging at you is "Why were they called the Inner and Middle Temple?" You either know why, and are wondering if I'll address the subject, or don't know why, and are hoping I'll answer your question. Good news for both: I'll answer the question tomorrow.