Millennia of scholarship shows many reasons, but the Kli Yakar also provides several, two of which we'll discuss here.
1) The Magic Wand Controversy
As we've seen throughout the Torah, Moshe Rabbeinu's staff was involved in several amazing incidents, the most visible being the parting of the Yam Suf, when Moshe Rabbeinu raised his staff and the sea parted.
And people weren't entirely sure whether he was performing all sorts of supernatural feats via occult powers and using the staff as a conduit OR whether these miracles were really just directly from Hashem.
In other words, was Moshe Rabbeinu the greatest sorcerer or the greatest prophet? Hashem wanted to make it clear to the Jewish people.
Hashem also wanted to make it very clear to the people that the staff itself held absolutely no power. His intention was for this moment to be a tremendous lesson and strengthening of emuna.
But it wasn't.
The Kli Yakar refers to the famous verse in Mishlei 17:10:
"The humility caused by the rebuke of an understanding person [is more effective] than a hundred blows to a fool."
Out of Hashem's great Love for us, He did not want us to be the kind of people that you have to "hit" in order to get them back onto the straight path. He did not want to have to strike us will kinds of troubles and trials in order to return us to the Torah way.
He just wanted us to listen, listen to what's written in the Torah and to what the prophets say, and then that should have been enough.
Because of this, it was vitally important for Moshe Rabbeinu and Aharon Hakohen to just speak to the rock before all the people, and not to hit it at all.
But with the best of intentions, they did the opposite: Not only did they not even speak to the rock at all, but Moshe Rabbeinu even hit the rock - and he hit it twice.
And this is the chilul Hashem that Bnai Yisrael would learn from it: not to listen to the voice of mussar, but instead [to obey] only "after 100 blows to a fool."
And this is a very true hint....
Rabbi Shlomo Ephraim of Luntschitz (1550-1619) lived in Bohemia (which is today Poland and Czechoslovakia).
He served as rabbi and dayan and wrote several books, the most well-known being his commentary on the Chumash known as the Kli Yakar.
This is my own translation and any errors are also mine.