Most of us have heard some of Chabad's 'proofs' for the messianic status of the late Rebbe. One of my favorites is achieved with gematria, the numerology many Orthodox Jews believe God coded into the Hebrew language. The numerical value of "beit mashiakh" (house of the messiah) is 770, which just happens to be both the address and the name of the main Chabad synagogue in Crown Heights. This little oddity isn't much of a proof, but it does have a certain effect on believers.
But gematria has a rather checkered past. Its name is Greek and its origin is Babylonian – not Jewish. Greeks were using this system for occult practice years before Jews were. Indeed, it seems Jews picked it up through contact with the Greeks, although it may have entered Judaism during the Babylonian exile. Either way, it is not by origin a Jewish concept.
Gematria does not begin with the rabbis, though, nor even with the Greeks; its earliest use on record is Babylonian, and it occurs in an inscription dating from the reign of Sargon II (727-707 BCE), saying that he built the wall of the city of Khorsabad to be 16,283 cubits in length because that was the number equaled by the letters of his name — the full, honorific form of which was much longer. From the Babylonians, gematria spread to the Greeks, who called it isopsepha (equal counting) and used it widely for magical and occult purposes.
But it was in medieval Judaism that gematria was most systematically employed for a wide variety of religious purposes, ranging from halachic reasoning to kabbalistic theosophy to messianic speculations on the times and dates of redemption. The 17th-century messianic movement of Sabbatianism, built around the figure of purported messiah Sabbatai Zevi, resorted to gematria repeatedly in its efforts to prove that the latter was indeed the Redeemer. Thus, for example, finding in the ancient midrashic compilation of Genesis Rabba the statement that the biblical verse in the account of Creation, "... and the spirit of the Lord hovered over the face of the water," alluded to the spirit of the messiah, Zevi's followers calculated that the Hebrew letters of "the Lord" and "hovered" equaled those of his name.
Needless to say, if one takes enough biblical verses and does enough calculations with them, it always will be possible to find some word or combination of words that will yield the desired results.
A major proponent of gematria was the Ari, Rabbi Isaac Luria, the 16th century "mystic" whose system of kabbala was "taught" to him in "night visions" by "Elijah the Prophet." The Ari changed traditional kabbala which had roots going back to at least the first century CE, superimposing his new doctrines where it was possible, and scrapping older teaching where it was not. The Ari was opposed by the majority of kabbalists living at that time, but the Ari's "system" became dominant anyway. Why?
Because, before the Ari, kabbala was only taught to a few select students, usually by a master who taught one or two students at a time, and whose lessons stretched over many years. Indeed, this was the halakhic way to teach kabbala. The Ari, claiming "Elijah the Prophet" as his source, began to teach the secrets of kabbala openly to many students – many of whom would not have otherwise merited to learn it. It was this anarchy and these students who spread the Ari's (or is that "Elijah's"?) teachings worldwide.
An example of the difference between the two schools: Early kabbala envisioned an ancient universe, far older than 6000 years, with worlds created an destroyed in the process. (Their understanding of "created and destroyed" is similar to upheavals like the beginning or ending of an ice age or a major volcanic eruption like Toba, rather than repeated Big Bangs.) The Ari allegorized these ideas, claiming that those worlds "created and destroyed" were completely spiritual, and that the entire creation (in today's measure) is less than 6000 years old. We know who was right on this point.
As Philologos notes, Sabbatians made extensive use of gematria to "prove" that Shabbatai Tsvi was the messiah. Gematria was also used by the nascent hasidic movement to validate its theology and leadership. And that brings us back to 770, the "house of the messiah."
Chabad's messianic foolishness (or heresy, depending on one's view) is an outgrowth of both Lurianic and Sabbatian theology, the first intentional, the second not. Shabbatai Tsvi's followers raised Lurianic kabbala to new prominence. Even the unlettered were fond of dabbling in its mysteries. Rabbis across the world gave kabbalistic sermons influenced by Shabbatai Tsvi's teachings. When it became clear that Shabbatai Tsvi was not the messiah, Lurianic kabbala fell out of favor with the masses. But teachers of the "new wisdom" continued to hold classes and give kabbalistic sermons, some still using Shabbatai Tsvi's kabbalistic teachings and some not. It was from that group of "mystics" that the Baal Shem Tov came. Indeed, many of the 1st, 2nd and 3rd generation leaders of the new hasidic movement cherished books of kabbala that have been proved to be Sabbatian in origin, although it seems likely most were unaware of this – just as many Chabadniks are unaware of the very checkered history of their "house of the messiah."