Anger and the like are attributed to God on account of a similitude of effect. Thus, because to punish is properly the act of an angry man, God's punishment is metaphorically spoken of as His anger.
St Thomas Aquinas (2013). “Summa Theologica, Volume 1”, p.16, Cosimo, Inc.