because he struck the rock instead of just speaking the Word of Yhvh to it for water to come forth.
His anger mis-represented Yhvh's compassion and provision to the Israelites,
Numbers 20:7-12King James Version (KJV)
7 And the Lord spake unto Moses, saying,
8 Take the rod, and gather thou the assembly together, thou, and Aaron thy brother, and speak ye unto the rock before their eyes; and it shall give forth his water, and thou shalt bring forth to them water out of the rock: so thou shalt give the congregation and their beasts drink.
9 And Moses took the rod from before the Lord, as he commanded him.
10 And Moses and Aaron gathered the congregation together before the rock, and he said unto them, Hear now, ye rebels; must we fetch you water out of this rock?
11 And Moses lifted up his hand, and with his rod he smote the rock twice: and the water came out abundantly, and the congregation drank, and their beasts also.
12 And the Lord spake unto Moses and Aaron, Because ye believed me not, to sanctify me in the eyes of the children of Israel, therefore ye shall not bring this congregation into the land which I have given them.
(and provides a lesson ever since then for all of us who are within Yhvh's Will)
2 Timothy 3:16
All
scripture is given by inspiration of God, and is
profitable for doctrine, for reproof, for correction, for instruction in righteousness: