Answer: Since before the Exodus, the Israelites had a tendency to whine and complain about a whole host of things, including their leaders like Moses.
The children of Israel, sometime after leaving Egyptian slavery, had a dire need for water. Instead of asking and having faith in God, they turned to complaining against their human leaders who were Moses and Aaron. They whined about being brought out to the wilderness so that, they assumed, both they and all they possessed would be no more.
Why did you bring us out of Egypt into this miserable place where nothing will grow? . . . There is not even any water to drink! (Numbers 20:5).
What was the solution to the problem of no water for the people, cattle, and so on in the desert wilderness of Zin? God stated that the two men were to take Aaron's rod and speak to a certain rock (Numbers 20:8). After they did this, water would miraculously come out and give much needed water to the people.
Moses and Aaron did most of what God commanded, except that they were so angry with the people that they made it appear as if they, by their own power, were quelling the thirst of the people. The Bible records that they said the following.
Hear now, you rebels! Must we (not God) bring water for you out of this rock?" (Numbers 20:10).
This was followed by Moses striking the rock twice, with the rod they brought, instead of speaking to it as the Eternal commanded (Numbers 20:11).
Why they were left out
In Number 20 verse 12 we find God leaves no doubt as to why his chosen leaders didn't go into the land of milk and honey promised to Abraham, Isaac and Jacob.
Then the Lord spoke to Moses and Aaron, 'Because you did not believe Me, to hallow Me (proclaim my name holy) in the eyes of the children of Israel, therefore you shall not bring this assembly into the land which I have given them.' (Numbers 20:12).
Aaron died, as God said in verses 12 and 24, for his part in the rebellion at the rock of Meribah. He died on Mount Hor (Numbers 20:25 - 28), which is thought to have been directly south of Jerusalem.
God allowed Moses, before he died at Mount Nebo (located directly east of Jerusalem), to view the broad panorama of the land inheritance he swore to give the descendants of Abraham, Isaac, and Jacob (Deuteronomy 34:4 - 5).
God, after Moses died, buried his body in a secret place where no one would be able to find it. It is interesting to note that Mount Nebo is at a higher elevation than Mount Hor, thus providing a more spectacular view of the Promised Land God was to give the Israelites as an inheritance.