They're sorted chronologically within their particular subject matters.
First, the 5 books of the Pentetuch are packed together, these are all fairly chronological.
Then, comes the narrative history of the kingdom of Israel ( all of Jesus' glorious, inglorious and vainglorious ancestors) culminating with the exile and return of the Jews to their homeland.
Then I think you've got the Wisdom books (Job, lamentations, song of songs, psalms and proverbs) these are packed together because theyre not really chronological and they weren't exactly each written in one sitting either.
Finally you've got the Major Prophets and the minor prophets. Major Prophets are prophets who wrote a lot, minor prophets aren't. The confusing thing here is that some writings of the prophets (Jonah and Jeremiah) seem more like narratives and and you can kind of start wondering why Jonah getting swollowed by a fish is right next to PROPHECY AGAINST THE MELEKITES. But that's the reason, Jonah was a prophet (even if he never really got it)
Oh yeah, and then the New Testament. The Gospels are describing the same times. Acts is right after that (it's the sequel to Luke, but it comes in the Bible after John because they group the 3 similar accounts (Matthew, Mark and Luke together). The Letters of Paul, James, Jude, John and Peter aren't chronological in nature. They do all come after Acts (but weren't necessarily written down after acts). Revelation, the last book, is probably the last chronologically, although it's more like the works of the prophets in the OT, it just comes last because it comes last.