They got it from the Hebrew scriptures that had been written from over 2,000 years BEFORE Christ was born, up till 400 years BEFORE He was born. We know that collection of scriptures as the Old Testament.
The Hebrew scriptures form about three-quarters of the Bible, so why does everybody on here think the Bible is only the last quarter, known as the New Testament? Such ignorance is appalling.
Christianity had to be built upon the written foundation of those ancient holy scriptures, written by various men in the Mosaic (old) Covenant. They detailed God's dealings with His covenant people over the centuries, where the Messiah was promised to come, and that Messiah came with the birth of the virgin Mary's son. Within 20 years or so of Jesus' death and resurrection, His followers began writing accounts for the young Christian church because thousands of converts had responded to be verbal gospel message (the good news about Jesus Christ). They quoted profusely from the OT, to prove that Christ was the foretold Messiah. Jesu Himself used the OT constantly, explaining its meaning. Before the end of the first century, the last of those New Testament writings had been completed, and were being spread around the many congregations.
The Bible was completed before A.D. 95. The young Church had ALL of the Bible (Old and New Testaments) by then. What is this nonsense about "the bible was invented around 300 AD"? Please deal with this rubbish. And stop perpetuating it.