Because of His holy nature, God’s character can only be one of moral goodness.
Jesus speaks of being "good" with a meaning towards moral goodness in reference to God who is morally perfect.
And He said to him, "Why are you asking Me about what is good? There is only One who is good; but if you wish
to enter into life, keep the commandments." Then he said to Him, "Which ones?" And Jesus said, "You shall not commit murder; You shall
not commit adultery; You shall not steal; You shall not bear false witness; Honor your father and mother; and You shall love your
neighbor as yourself." (Matt 19:17-19)
God’s holiness emanates moral perfection, and encountering Him demands moral perfection in both the spiritual and physical sense.
Jesus says God is good, because in encountering His realm evil cannot exist.
To learn more, see:
God is Good
The Glory of God
Examining the Origin of Morality