Lets review the following scriptures. It's good to read and understand what is being said.
But I tell you that anyone who is angry with his brother will be subject to judgment. Again, anyone who says to his brother, 'Raca,' is answerable to the Sanhedrin. But anyone who says, 'You fool!' will be in danger of the fire of hell.
John 2:13-17 (also Matthew 21:12-13, Mark 11:15-18, Luke 19:45-46)
When it was almost time for the Jewish Passover, Jesus went up to Jerusalem. In the temple courts he found men selling cattle, sheep and doves, and others sitting at tables exchanging money. So he made a whip out of cords, and drove all from the temple area, both sheep and cattle; he scattered the coins of the money changers and overturned their tables. To those who sold doves he said, "Get these out of here! How dare you turn my Father's house into a market!"
His disciples remembered that it is written: "Zeal for your house will consume me."
Another time he went into the synagogue, and a man with a shriveled hand was there. Some of them were looking for a reason to accuse Jesus, so they watched him closely to see if he would heal him on the Sabbath. Jesus said to the man with the shriveled hand, "Stand up in front of everyone."
Then Jesus asked them, "Which is lawful on the Sabbath: to do good or to do evil, to save life or to kill?" But they remained silent.
He looked around at them in anger and, deeply distressed at their stubborn hearts, said to the man, "Stretch out your hand." He stretched it out, and his hand was completely restored. Then the Pharisees went out and began to plot with the Herodians how they might kill Jesus.
Jesus is indeed shown as displaying anger in the latter two passages above. However, consider the context of each. In the case of the temple, Jesus threw out usurers and others who were taking advantage of the poor. He was angry at the wrong they were doing and also at the blatant disrespect for God they showed by doing wrong even in God's temple. In the next passage, Jesus was angry with the Pharisees, who wanted to catch Jesus breaking one of their laws, yet were unwilling to consider the morality of the law or to believe in Jesus despite seeing the miracles he did. In both cases, Jesus was angry with people who were doing wrong and refused to listen to God.
And is such anger wrong? To say "God is never angry" or "God should never be angry" is to say that God shouldn't be angry when innocent people are hurt or killed, or that he shouldn't be angry that the Holocaust took place. There are different kinds of anger, as described in the Merriam-Webster dictionary:
ANGER, IRE, RAGE, FURY, INDIGNATION, WRATH mean an intense emotional state induced by displeasure. ANGER, the most general term, names the reaction but in itself conveys nothing about intensity or justification or manifestation of the emotional state "tried to hide his anger". IRE, more frequent in literary contexts, may suggest greater intensity than anger, often with an evident display of feeling "cheeks flushed dark with ire". RAGE suggests loss of self-control from violence of emotion "screaming with rage". FURY is overmastering destructive rage that can verge on madness "in her fury she accused everyone around her of betrayal". INDIGNATION stresses righteous anger at what one considers unfair, mean, or shameful "a refusal to listen that caused general indignation". WRATH is likely to suggest a desire or intent to revenge or punish "rose in his wrath and struck his tormentor to the floor".
Indignation, as described above, is what could be called righteous anger - anger at wrongdoing. This is Jesus' anger, for Jesus is angered by wrongdoing. Clearly some forms of anger such as fury as defined above are wrong, and this is the anger that Jesus spoke out against in Matthew 5:22 - anger that is destructive and unnecessarily demeaning.