ok
EDIT: Just "Ok" looks too snarky to me. I shouldn't have left it at that. What I posted is a summary of literally hundreds of pages of peer-reviewed journals I've read regarding this subject since the start of my Beer History class this semester. I see you disagree, which is fine, but the evidence is against you. The "accidental discovery" theory has largely been abandoned by scientists and historians, but apparently not by mainstream brewing publications.
One of the progression theories I read about holds that baking a beer bread - bappir - as the Egyptians called it (this part is very well documented), with coursely ground grains, then soaking it in warm water created conditions similar to mashing, which over time led to the realization that the bread was not necessary and the grains could be directly mashed. The archealogical record seems to support this theory, as later Egyptian period finds show that Egyptian breweries - two of which have been positively identified - no longer had bread baking equipment on site as earlier breweries did.
The malting process likely was discovered accidentally. It makes perfect sense that tasting grains that had begun to sprout would have yielded a sweeter, and therefore more desireable, flavor. But the process of mashing was almost certainly not discovered when someone "accidentally" left sprouted grains outside in a rain storm, as has been pushed in brewing "history" books for some time now. The real historians do not support this theory anymore because there is absolutely no evidence to back it up, while evidence does exist as to a progression of discoveries which eventually led to a very recognizeable (to us) brewing process being carried out by the Egyptians and Mesopotamians/Babylonians around 3000-4000 BC. If you were teleported to an Egyptian or Mesopotamian brewery 5000 years ago, you would no doubt realize what was going on. The technology was different obviously, but the process was very similar by this time.
Furthermore, while we would love to believe the opposite, beer was certainly not the first fermented beverage that man enjoyed. Other more readily fermented sugars were widely available to ancient man in the fertile crescent: figs, dates, grapes, etc. As these will all naturally ferment without human intervention, they were mostly certainly ingested before grains were "discovered" and cultivated.