For nearly 200 years the sages worked together to write down Jewish law so that it would not be forgotten. This Herculean effort, the מִשְׁנָה / Mishna, was finalized around 190 CE. Another work of this same time period was the ברייתא / Baraita which recorded teachings "outside" of the six orders of the Mishna. The word ברייתא / Baraita means "outside." The תּוֹסֶפְתָּא / Tosefta was also collected -- this was "additional" or "supplementary" information.
Jews being Jews, no sooner was the מִשְׁנָה / Mishna complete then the debates began. I use the word "debate" -- but let me be clear there is not even ONE argument in the Talmud about core matters of Judaism. Each and every single dispute in the history of Jewish Law has been about a minor detail of the Law.
Let me repeat that, because some missionaries make a "big deal" about the fact that the Gemara is written as dialog with one Rav' saying one thing which another saying the opposite. . . this is the manner in which Jews learn. BUT there is not even one disagreement in the entire Talmud about anything that is a core issue (not about which mitzvot we should or should not follow for example).
The debate was never about what the law required (for example, the Mishna says we are commanded to kindle Chanukah candles as part of the celebration), but rather sometimes the minor details were in question (should we light the Chanukah candles starting with one, and adding a candle each night, or should we start with eight candles and remove a candle each night?).
The discussions and debates around the law (halacha) lasted for 200 years in Judah and 300 years in Babylon.
Another point of clarification -- although we speak of R' Y'hudah HaNasi as completing the Mishna (for example) we are just giving the name of the head of the effort. Neither the Mishna nor Gemara was a "one man" process. All of the learned Jews of the era who could be rounded up for the process were part of the process. The sages literally found every reliable Torah Scholar they could and that person became a part of the process. We have a list of the names of the תנאים / Tannaim (teachers) and אמוראים / Amoraim (sayers or spokesmen) who later compiled the Gemara. Some of the names can be found here. The work was done in public -- nothing was hidden. This was a Herculean effort -- all to ensure the accuracy and that not "one" opinion could sneak in by accident.
If you recall from the last post, the authors of the Mishna are called תנאים / Tannaim (teachers) . The men who compiled the Gemara are called אמוראים / Amoraim (sayers or spokesmen). There was a man named אבא אריכא / Abba (father) Arika who was the last of the Tannaim and the first of the Amoraim. He moved to Babylon and headed a Yeshiva (school) at Sura (Babylon). R' Arika was a follower of R' Y'hudah HaNasi (Judah the Prince), the Tannaim who finalized the Mishna.
Around 219 CE R' Arika moved from Judah (Israel) to Babylon.
Once the Mishna was complete sages in both Judah (Palestine) and Babylon began to use it for study, and then began the legal discussions, the stories, the debates and even histories. . . The great yeshivot (schools) in Palestine and Babylon studied the Mishna exhaustively and over the next hundreds of years the rabbis in Babylon and Palestine began to write down these discussions in a series of books that came to be called גמרא / Gemara (which means "to study").
The communities were separated by over 500 miles, and 1800 years ago travel by camel was about 25 to 30 miles per day. Without problems it was a minimum of 20 days travel -- thus the study was done in two separate communities -- one in Palestine and one in Iraq (Babylon). Out of these two communities emerged the תַּלְמוּד יְרוּשָׁלְמִי / Yerushalami (Jerusalem or Palestinian) Talmud and the Bavli (Babylonian) Talmud. The Bavli was published around 500 CE, while the Palestinian Talmud was published around 400 CE. When people speak of the תַּלְמוּד / "Talmud" they mean the Mishna and the Babylonian Talmud.
The community in Palestine was under initially Roman, and later Christian control. A central Yeshiva met in Teveryah (Tiberias), but as Christianity grew in what remained of the Roman Empire it became more and more difficult for Jews to work on the Gemara. What do I mean by "more difficult"? Jews lost most of their civil rights. A Jew marrying a Christian was put to death. The Sanhedrin, was forbidden to meet These are just two examples of the severe repression against Jews. Just existing became difficult, making it almost impossible to complete the discussions around the Mishna. As a result the Palestinian Talmud remained fragmented with whole parts of it lost (or never completed).
Interestingly enough the Jerusalem / Palestinian Talmud covers all the tractates of Zeraim (seeds) while the Babylonian Talmud only has one tractate (Berachot - blessings). Since halacha (Jewish law) pertaining to farming is relative only in the holy land the topic may not have been considered that important in Babylonian exile. . .
The community in Babylon was growing and flourishing. 10,000 Jews initially were exiled in Babylon around 434 BCE (and 11 years later the rest of the Jews followed). A majority of the Jews there did not return to Israel with the prophet Ezra. Most remained in Babylon, and Jews lived there for 2400+ years, until they were exiled by the Iraqis in 1948 when the modern state of Israel was created.
After the destruction of the Temple in 68 CE in Jerusalem and the later rebellion resulting in the Romans exiling most of the Jews from the land in 135 CE many moved to Babylon to an already flourising Jewish community. The few Jews who remained after 135 CE were subject to Roman persecution and eventually Christian persecution. In 363 CE the Roman Empire shut down the Sanhedrin (Jewish courts / governmental system) and the main Jewish community was well established in Babylon.
The head of the Jewish community in Babylon was the ריש גלותא / Rosh Galut (Head of the Exile). The Rosh Galut was a direct descendant of King David. For over 40 generations (1500 years) he was considered to be Even the representative of the Jewish community in Babylon (sometimes just as a figure head). The Jews of Babylon were an oasis in the world of Jewish exile. Ergo they had the luxury of spending hundreds and hundreds of years discussing, debating and compiling the Babylonian Talmud.
Jews learn by discussion and dialog. Rarely is there a teacher who stands in the front of a room lecturing. In Jewish schools people sit around a table, read a line or a paragraph and discuss it -- possibly for hours on end. A Jew sitting down to read a page of the Gemara this is like entering a classroom -- the very discussions in the Talmud are akin to the discussions in a Jewish Yeshiva. To a non-Jew who reads a translation of the Gemara they are confused -- it seems like a bunch of people sitting around and arguing. What the non-Jew sees as confusion the Jew sees as a teaching method. There is even a name for this method -- On every page it seems that the rabbis are arguing. This kind of argument ― the purpose of which was to arrive at the kernel of truth ― is called פלפול, from "pepper." Spicy. It is an intense and detailed method of learning.
To a non-Jew (especially a Christian who thinks Jews are too "legalistic") it seems like hair splitting. To a Jew it is a method to determine how to apply every single mitzvah in the written Torah to the world we live in even today. We have to understand not only the details, but the logic. The Gemara is looking at every kernel to make sure we don't miss a single thing. The bottom line is -- are we doing what G-d wants us to do?
Another important point is that much of the discussion and dispute is focused on relatively minor points while the larger issues are generally not disputed. I discussed this earlier, using the example of lighting Chanukah candles. On the big issues there is no debate -- no one questioned whether or not we should keep kosher, or if maybe somehow a pig could be made kosher. Those things had no reason to be discussed because the written Torah makes it clear what is and is not kosher. The oral mitzvot tells us HOW to butcher a kosher animal. . . none of those things were in question. They were totally in agreement on the big issues.
So there you have it -- the Talmud is comprised of Mishna and Gemara. When we say "Talmud" we mean the Babylonian Talmud (the Jerusalem Talmud was never completed do to persecution).
Along with the discussions on the finer points of Jewish law, the Gemara includes אגדתא / Agadata -- stories meant to emphasize a moral point in the bible.
So the Talmud is not the evil thing some anti-semites claim. It is not hidden either. The Talmud is not "holier" than the written Torah -- they are companion works. You truly cannot understand the written Torah's mitzvot without the Talmud.
Since the Babylonian Talmud was completed some 1600 years or so ago Rabbinic commentary has continued. It continues to this very day -- because learning, debate and discussion is a very important part of the Jewish people.