I don't recall reading in the Law, "You shall hate your enemy." So when Jesus says, "You have heard that it was said, 'You shall love your neighbor and hate your enemy,'" some people think the enemy part was added by the religious leaders. That sounds plausible to me, and I can see why the religious leaders would make that addition. The Law emphasizes love for fellow Israelites--and you do have to admit that God's command that Joshua and his armies slaughter all the inhabitants of Canaan does kinda lend itself to an "us vs. them" mentality.
But once again, Jesus asks us to dig deeper into the meaning of the Law. How we love has to do with our understanding of God himself. The Jews are used to thinking of Yahweh as the God of Israel, but he is in fact the God of the whole world. It makes sense to only love your Israelite neighbor if you think God just loves Israelites. But if you consider that God gives the whole world sun and rain, that he takes care of the righteous and the unrighteous indiscriminately, then suddenly you realize that he loves those who do not worship or acknowledge him. God loves his enemies, the worshippers of Baal and other detestable gods. To love as God loves means to love your enemies too.
You can hardly blame the Jews of Jesus' time for thinking they have the right to hate their enemies. Joshua and the battle of Jericho is a part of their history. Samson warred against the Philistines. David fought Goliath. Solomon had no mercy on his enemies. For at that time God commanded his people to establish the promised land as a place where his holy presence might dwell. Solomon built the temple, the cloud of God's glory descended upon it, and the Davidic kings were charged with guarding that holy presence. Wiping out foreign invaders who would defile the land taught both Israel and the surrounding nations about God's holiness, that an insurmountable barrier existed between the holy and the unholy, that to approach God's holiness is to imperil your own life.
But Jesus is preparing the way for the new work God will do among his people. God's real desire was never to dwell in a man-made temple but in the hearts of his own people. He wants to claim our bodies as his holy temple, to be united to us in a marriage union, yet the "land" of our souls is defiled by sin. Jesus is the new Joshua who invades our hearts and vanquishes the real enemy--not the Canaanite or the Hittite--but sin itself. Through his death and resurrection he clears away the defilement so that we might be baptized with his Holy Spirit, his own presence dwelling in us.
Therefore love your enemies, because the true enemy is not them, but sin. Loving them may be the way Jesus conquers their hearts too, and transforms them from enemies into friends.