The history of the accepted Biblical canon is a rather long and complex story. However here is a basic summary:
There existed in Judaism two basic sets of canons for the Scriptures. There was one canon that was entirely in Hebrew that contained 39 books, called the Masoretic text. During a diaspora of the Jewish people there arose a Greek version of the Scriptures that contained more books and some books that they held in common were longer in the Greek canon. This canon was called the Septuagint or the LXX ("the 70", from the legend that it was composed by 70 translators).
The New Testament mainly quotes from the Septuagint since the NT was also written in Greek. Early Church fathers also freely quoted from the Septuagint and appear to have presumed that it was inspired Scripture.
The Jewish community did not settle its dispute about which canon it would accept until the Council of Jamnia in 90 AD. The Council of Jamnia rejected the Septuagint for several reasons but among them was that the newly formed Christian community was using it. However the idea of a set universal canon was not present for a few centuries. Local communities of both Jews and Christians would differ slightly in what they accepted as canonical for the first few centuries AD. It wasn't until the 4th century AD that Christianity universally recognized 27 books in the New Testament and also accepted the Septuagint's Old Testament as canonical.
The Protestant Reformation viewed the additional books of the Septuagint as inferior because they were not written in Hebrew and had not been accepted by Judaism. They also viewed them with suspicion because they contained such Catholic notions as praying for the dead and works being necessary in addition to faith. However while early Protestant leaders (like Martin Luther) did not consider the extra Septuagint books canonical they did include them in a separate section of their Biblical translations as books that while not inspired were "useful and good to read."
So, essentially, from the 4th century until the 16th century Christianity universally had 46 books in its Old Testament canon. The Catholic (and Orthodox) Church accept the full traditional Old Testament canon while the Protestant communities have, over the centuries, decided to recognize only the Masoretic canon.