One of the most surprising facts about the number of books in the Old Testament is that this is not a discussion that was born at the time of the Protestant Reformation, in the 16th century.
Much earlier, in the 5th century, St. Jerome translated the Bible for the first time from the original Hebrew and Greek into Vulgar Latin (hence this version is known as "St. Jerome's Vulgate"). There is an important detail: Jerome, like Luther a thousand years later, included in his translation of the Old Testament only 39 books. Therefore, this is not a discussion between Catholics and Protestants. In any case, it is a discussion inherited by the Catholic and Protestant (or Reformed) churches of today.
In favor of saying that the Old Testament has 39 books we can refer to the phrase "salvation comes from the Jews" (Jn 4:22). And if salvation before Christ comes from the Jews, therefore we must accept in the Old Testament the books considered as inspired by the Jews today. That is, only 39 books, all written in Hebrew.
Someone who is in favor of the canon of 46 books in the Old Testament will then say that the so-called "apocryphal" books were in the Jewish bibles. They were not included in the Bibles in Hebrew, but Greek-speaking Jewish communities did consider them as part of their Scriptures. The "Greek" Bible is known as "the Septuagint", or "of the 70", because it is believed to have been translated from Hebrew into Greek by 70 wise men.
There are two facts to note about this Greek version:
1) These 70 wise men not only translated books from Hebrew but also incorporated others, those we know today as "apocryphal" (by the Protestant churches) or "deuterocanonicals" (by the Catholic Church).
2) This is the version used by the New Testament writers when quoting the Old Testament. There is even a prophecy quoted by Luke about Jesus that is only fulfilled if we take the "Septuagint" version. In fact, in the Hebrew Bible it says "thou shalt not let thy servant know the grave" (Psalm 16:10) while the Seventy's says "thou shalt not let thy servant know corruption". While the prophecy is not fulfilled according to the Hebrew bible, since Jesus was indeed laid in a tomb, it is fulfilled according to the Septuagint.
Taking this into account, could we not say that the 46 books of the Septuagint should be considered as inspired? It is worth mentioning that the Jewish community would end up bringing out the apocryphal/deuterocanonicals only in the second century, probably as a reaction against Christians.
And here those in favor of the Old Testament having 39 books argue: it is true that the Septuagint is important, that it was used by the evangelists and New Testament writers, but that does not mean that all of the Septuagint should be held as inspired. In fact, it is notable that no apocryphal/deuterocanonical is cited in any New Testament writing, perhaps because those who wrote them did not consider those books as inspired.
As I said before, in Luther's time there was nothing new in this discussion. And he chose to keep only 39 books in the Old Testament. Surely one of his reasons is that in one of those apocryphal books there appears a scene that seems to support the Catholic doctrine of Purgatory and the sale of indulgences that so outraged the Reformer (2 Maccabees 12:45).
The Catholic Church, on the other hand, only after the Lutheran Reformation, in the Council of Trent (also called "the Counter-Reformation") established as dogma that the deuterocanonical books are part of the Bible. And it is here where this issue ceased to admit reasoning and became an issue of authority. Who has the authority to determine what to believe? The Pope of Rome? Or Luther?
But this writing is not about authority, which has to do with faith, but about what to include or exclude from a library, which is more of a literary question.