The office of the chancellor grew out of the ancient Roman position of cancellarii, a minor legal official that stood by a cancellus (Latin for "bar") that kept the general public from the tribune. Cancellarii began to be employed in writing departments. Later, Barbarian societies adopted many Roman customs and the word -- and the office -- evolved.
Chancellors were required to be able to read and write, a skill that was, until the 13th century, rare outside the clergy; thus, the position was always filled by an ecclesiastic. The chancellor was keeper of the great seal used to validate royal documents, and thus he became the most powerful official in most medieval kingdoms. As the power of the office grew, the people assigned to fill the post were drawn from positions of prestige. Eventually, most chancellors were also bishops or even archbishops.