If the phrase "you have heard" refers to the Scriptures, why is hating one's enemy not written in the Old Testament.
Matthew 5:43 ASV Ye have heard that it was said, Thou shalt love thy neighbor, and hate thine enemy:
Biblical Hermeneutics Stack Exchange is a question and answer site for professors, theologians, and those interested in exegetical analysis of biblical texts. It only takes a minute to sign up.
Sign up to join this community"You have heard that it was said" is a line Jesus used to repeat what the illiterate masses (as he was speaking to) were taught by the "teachers of the law. It occurs a number of times such as Matt 5:21, 27, 31, 33, 38, 43, etc.
Note especially that it occurs in a modified form twice as "you have heard that it was said to the ancients" suggesting that Jesus is repeating what the scribes and pharisees taught and then goes on to contrast with what He (Jesus) is about to teach.
Therefore, we should not be surprised that some extra "pharisaic" (extra-biblical) teaching had crept into their ideas which Jesus was always trying to dispel as recorded in later sermons.
So, it is true that "hate your enemies" is not in the OT as a moral teaching - it was propagated by the scribes and pharisees as their means of promoting Jewish superiority and spiritual smugness.
This is also confirmed by Matthew's oft-repeated phrase, "as it is written" referring specifically to what is recorded in the OT. That is, "you have heard it said" is what the teachers teach as distinct from what is written in the Bible.
The phrase "you have heard" does not refer to the scripture, it refers to oral teachings of the Pharisees who violated scripture with their own tradition, as per Matt 15.3:
But he [Jesus] answered and said unto them, Why do ye also transgress the commandment of God by your tradition?"
Cursing enemies was a regular part of that Pharisaic tradition as well as traditional teachings in other sects.
For the apostates let there be no hope,
למשומדים אל תהי תקוה
and may the kingdom of the arrogant
ומלכות זדון
be quickly uprooted in our days;
מהרה תעקר בימינו
and may the natzarim and minim
והנצרים והמינים
instantly perish;
כרגע יאבדו
may they be blotted from the book of the living,
ימחו מספר החיים
and may they not be written with the righteous.
ועם צדיקים אל יכתבו
Blessed are you Lord,
ברוך אתה יי
humbler of the arrogant.
מכניע זדים
(4) that he has chosen and hate all that he has rejected; that they may abstain from all evil [...]
(10) according to his lot in God’s design, and hate all the Sons of Darkness, each according to his guilt (11) in God’s vengeance. All those who freely devote themselves to his truth shall bring all their knowledge, powers,
(21) from all injustice. These are the rules of conduct for the Maskil in those times with respect to his loving and hating everlasting hatred (22) toward the men of the pit in a spirit of secrecy. He shall leave to them wealth and earnings like a slave to his lord and like a poor man to
Part of the reason for this may have been the tradition of both blessing and curses on mount Ebal/Gerizim (Deut 11.26), but whatever the historical reason, to a pharisee curses and blessings were the flip side of the same coin. They blessed their friends and cursed their enemies in the same breath and as part of the same prayer.
David Instone-Brewer, Prayer and Agriculture, vol. 1, Traditions of the Rabbis from the Era of the New Testament (Grand Rapids, MI; Cambridge, UK: William B. Eerdmans Publishing Company, 2004), 97–101
Alex P. Jassen, “Rule of the Community,” in Outside the Bible: Ancient Jewish Writings Related to Scripture: Translation, ed. Louis H. Feldman, James L. Kugel, and Lawrence H. Schiffman, vol. 3 (Philadelphia: The Jewish Publication Society, 2013), 2929.