Anger is not necessarily a sin by itself. The problem with anger, like the other Deadly Sins, is that it leads to the commission of sin.
According to the Catechism of the Catholic Church:
By recalling the commandment, "You shall not kill," our Lord asked for peace of heart and denounced murderous anger and hatred as immoral.
Anger is a desire for revenge. "To desire vengeance in order to do evil to someone who should be punished is illicit," but it is praiseworthy to impose restitution "to correct vices and maintain justice."
CCC 2302
In Mark 3, Jesus was not desiring vengeance in order to do evil to the Pharisees, he was angry because they were "looking for a reason to accuse [him]" (Mark 3:2) for healing on the Sabbath. Their attempt to prevent Jesus from doing good works on the Sabbath was unjust, so Jesus' anger was not sinful anger.
Similarly, Jesus was arguably angry with the money changers in the cleansing of the Temple because they had turned the Temple into a "den of robbers" (Mark 11:15-19). He was demanding restitution for the injustice (robbery/thievery) committed by the money changers.
God Himself is described as becoming angry elsewhere in the Bible. For example:
Then the Lord said to Moses, “Go down, because your people, whom you brought up out of Egypt, have become corrupt. They have been quick to turn away from what I commanded them and have made themselves an idol cast in the shape of a calf. They have bowed down to it and sacrificed to it and have said, ‘These are your gods, Israel, who brought you up out of Egypt.’
“I have seen these people,” the Lord said to Moses, “and they are a stiff-necked people. Now leave me alone so that my anger may burn against them and that I may destroy them. Then I will make you into a great nation.”
Exodus 32:7-10 (NIV)
Although God is capable of anger, he is slow to anger and forgiving:
Then the Lord came down in the cloud and stood there with him and proclaimed his name, the Lord. And he passed in front of Moses, proclaiming, “The Lord, the Lord, the compassionate and gracious God, slow to anger, abounding in love and faithfulness, maintaining love to thousands, and forgiving wickedness, rebellion and sin. Yet he does not leave the guilty unpunished; he punishes the children and their children for the sin of the parents to the third and fourth generation.”
Exodus 34:5-7 (NIV)
God's anger is not sinful because sin is, by definition, an offense against God (CCC 1850).