The first Messianic prophecy occurs in the first book of the Bible, Genesis 3:15., probably written in the 15th century BC. We can't readily distinguish the chronology between the 5 books of the Pentateuch (Genesis, Exodus, Leviticus, Numbers, Deuteronomy), but they were among the first books of the OT to be written. Job is actually normally considered the earliest written book of the Bible, with an unknown date but with a proposed Messianic prophecy in Job 19:25 "I know that my Redeemer lives", described in this article. Besides Job, Genesis is seemingly the first to be penned.
Genesis 3:15 "And I will put enmity
between you and the woman,
and between your offspring and hers;
he will crush your head,
and you will strike his heel.”"
The significance of the verse (explained by Blue Letter Bible and Ligonier Ministries) is that the He is referring to Jesus and we know this because "he" is singular in Hebrew, even though the previous statement refers to the plural "offspring." A "surprisingly" similar verse in the New Testament is
Romans 16:20 "And the God of peace will crush Satan under your feet shortly."
It is likely that the "striking his heel" refers to Jesus' crucifixion, and the final crushing will occur at His Second Coming when He, holding the keys of death and Hades, will lock up and deal with Satan completely. The onset of the Kingdom of God also relates to Jesus "binding the strong man" (Mark 3:27).
So the prophecy is that a single, particular offspring (Jesus) will crush Satan, and Satan will strike his heel, corresponding to Jesus' crucifixion and 2nd Coming. This prophecy was likely recorded in written form (though passed down for generations accurately through oral transmission in an oral culture) around 1445-1405 BC. (The link is not an academic source; I have just seen that date range for the Pentateuch from multiple sources repeatedly).
Again, Job is proposed to be written earlier (unknown date) with a prophecy in Job 19:25 "I know my Redeemer lives." See this article.