Non-Violence or Violence
In the Sermon on the Mount, Jesus told his followers not to resist the evil person but to turn the other cheek, give the cloak as well as the tunic, and go the extra mile (Matthew 39-41). But he forcefully drove the money-changers out from the Court of the Gentiles of the Temple in Jerusalem (Matthew 21:12-13).
What appears to be a contradiction actually helps us to understand different expectations for different roles. In one role, we must love our human adversaries. In the other we must bring them to justice.
The same person can simultaneously be a student and a teacher, a son and a father, a Sunday school teacher and a soldier. Before Herod and Pilate, Jesus was silent as a sheep before its shearers, but in the Temple he was like a lion. He had two different roles. In one, he subjected himself to worldly authorities. In the other, he took charge.
In our role as rulers with Jesus in his heavenly kingdom (Ephesians 2:6), we are all called to overcome evil with good (Romans 12:14, 17-21). When, however, we find ourselves in a role with earthly authority, then we are also called to confront evil with the worldly instruments of that authority (Romans 13:3-4).
In Romans 13 the Apostle Paul notes that God delegates reward and retribution on the earth to earthly servants (Romans 13:1-7). Jesus underscores now God postpones his personal judgement and "causes the sun to rise on the evil and the good, and sends rain on the righteous and the unrighteous" (Matthew 5:45).
Being "Perfect" as God is
If God rewarded and punished behavior in this world, then our behavior could manipulate God. But God is complete. The Greek word used of him in Matthew 5:48 is teleios. It means that he acts according to his own perfection in complete independence of the way we treat him and independent of the way that we treat each other. Initiative is his, not ours.
In our role as "sons of our father in heaven," we are called to have similar autonomy. "Be teleios as your heavenly father is teleios" (Matthew 5:48). Like God, the way we act should not depend upon how we are treated. It should depend upon who we are rather than upon how those around us act.
Made for Dominion
But God has not left the world in anarchy. He created mankind in his image to rule (Genesis 1:26). In our role as children of Adam and Eve, we "fill the earth and subdue it" (Genesis 1:28). We need people who are teleios in roles that reward good and punish evil, so that judgments are objective rather than personal. Spiritual authority in Christ does not terminate our material authority in Adam.
Jesus was also a son of Adam and Eve. He has the right to rule on earth as well as the right to rule in heaven, so when he saw the Court of the Gentiles being used for exploiting rather than blessing all nations, he forcefully cleaned it up. One day his cleanup will include more than overturning tables.
Until that day of Jesus' return, we are called to love and pray for enemies while simultaneously bringing them to justice.