So here’s a very brief and patchy introduction to what the Old Testament is.
The Old Testament is a collection of books charting the history of the people of Israel from the time of their pre-history up until they were restored after the exile and a little beyond. It includes books about history, law, poetry, wisdom literature, prophecy and some apocalyptic literature. Some of the books are very short – Obadiah, for instance – and some are quite long – the Psalms or Isaiah.
When we try to say how many books there are in the Old Testament we come upon a bit of problem. Because the answer is, It depends. It depends on who you ask. If you ask a Catholic you’ll get a different answer than if you ask a Protestant or if you ask an Orthodox Christian. Broadly speaking the Protestant OT has 39 books, the Catholic 46 and the Orthodox 50. The books that are not included in the Protestant OT form the Apocrypha – of which the Church of England says, And the other Books (as Hierome saith) the Church doth read for example of life and instruction of manners; but yet doth it not apply them to establish any doctrine (from Article VI of the Thirty-Nine Articles of Religion in the Book of Common Prayer).
If we look at the way the books are arranged we’ll find a sort of pattern and logic to it. The logic breaks down a bit in places but generally speaking (taking the Protestant Old Testament) there are history books from Genesis to Esther. From Job to the Song of Solomon (or the Song of Songs) there are books of poetry and wisdom. And from Isaiah to Malachi we have the books of the prophets.
The books of the Apocrypha (which are in the Old Testament in Catholic and Orthodox bibles) are not so easily categorized. There are histories, there are wisdom writings and there are prophetic writings. Some of the books are additions to other OT books (to Esther and to Daniel) and others are complete works which stand alone.
How the books came to be included (or, in same cases excluded) from the canon of the Old Testament is a complex story. You can find some information here. In essence the Old Testament is the Hebrew scriptures of the Jews. The books of the Apocrypha (or the Deuterocanonical books) were mainly written in Greek. Although widely read they were not generally held to be authoritative in either Jewish or Christian circles. When Luther translated the bible he included only the 39 books, following the example of St Jerome (347-420) who translated the scriptures into Latin, we have in the Old Testament and consigned the others to the Apocrypha. The Catholic Council of Trent (1546) included the Deuterocanonical books. In this way we arrived at the Old Testament as we know it today.