The Early Church didn’t pay much attention to the Canon of the Old Testament. It was considered a Jewish book, and most Christian churches simply adopted whatever was in use by the synagogue down the street. But the Jews did not have an authoritative Canon (and they still don’t), so different regions had different canons. This is why the Old Testament of the Latin Church, for example, differs a bit from the Greek Orthodox (and other ancient Eastern Churches differ in other ways). It’s because the canons of the Synagogues in those areas were different. But this has never been a source of controversy or dispute among Catholics. For the most part, nobody really cares. If the Orthodox want to regard some book (or some portion of some book) as canonical that is not in the Latin Canon, that’s fine with me (and with every Pope who ever reigned).
Some forty years after the death of Jesus the Temple of Jerusalem was mostly destroyed by the Romans. Some Jewish leaders met in Jamnia to discuss this tragedy, and why God had allowed it. Some people call this the “Council of Jamnia,” but it was absolutely nothing like a Catholic Ecumenical Council. It had no authority whatsoever. And it was hardly “ecumenical” (which means universal). Jamnia (modern Yavne) is about 35 miles from Jerusalem, and the meeting was predominately attended by Hebrew (Aramaic) speaking Jews from that region.
The meeting did, however, exert a certain influence. One thing that this meeting concluded was that the Jewish people had strayed too far from their Jewish roots because of the diaspora - the scattering of the Jews (thanks to the Babylonians) 400 years before Christ. In the time of Jesus, the majority of Jews spoke Greek as their first language, and many writings had been included in Jewish Scriptures which had been originally written in Greek. The leaders at Jamnia encouraged Jews to reject any sacred writings which were composed in Greek (the Jewish Scriptures were continuously added to over the centuries). Gradually, these Greek works fell out of favor and ceased to be included in most Jewish canons.
The Christian Church took little notice. After all, Christians were perfectly OK with the idea of sacred writings composed in Greek, since almost all of the New Testament was originally written in Greek. A few influential Jews meeting in Jamnia 40 years after the death of Jesus (and grumbling about Greek) was of no concern to them. Heck, the early Christians mostly spoke Greek.
However, the protestants came about 15 centuries later. Like their Catholic predecessors, they looked at what the Synagogue down the street was using and adopted that. By this time, few Jewish canons included anything written in Greek, so the protestants threw out the Greek Old Testament books which had been in continuous use by all Christians for more than 15 centuries. This is why protestant Old Testaments differ substantially from Catholic ones (whereas Catholic canons might differ to a much smaller degree).
The New Testament Canon essentially came about by consensus. Many books were generally accepted by everybody by the mid Second Century, but a few were hotly contested (not surprisingly, the Book of Revelation tops that list). Others works were highly regarded (such as the Shepherd of Hermes), and many felt that such works should have been included.
The list of 27 books, as we know it today, was first proposed by St. Augustine, Bishop of Hippo (in northern Africa - not the better-known St. Augustine that wrote his Confession). But the canon was binding only within his Diocese. However, Pope Damascus accepted Augustine’s list, and thus the Canon became binding upon the entire Church.
The Canon was not formally and definitively recognized until the Council of Trent.