Brewing just seems like such a ridiculously complicated task. Why would someone think to do that?
Well, first, the concept of fermented alcoholic beverages is rooted in prehistory. There's at least evidence that some sort of crude beer was being made as far back as 9500 BCE- basically as soon as humans started large scale cereal farming operations. There's some loose claims that say that it's responsible for the rise of civilization, but it's generally treated as a fantastical interpretation of evidence. While it'd be valuable for it's ability to preserve the caloric content of the harvest, it's a bit of a stretch to say it's the basis of civilization.
By 7000 BCE Chinese were making alcohol from rice and fruit, though it didn't use a mold like sake.
The earliest firm evidence of intentional beer production dates back to ~3200 BCE, from an archaeological dig in the mountains of West Iran. Some of our earliest Sumerian writings include references to beer, and they had a goddess- Ninkasi- who was literally the goddess of beer.
We have evidence that beer production had spread through Europe by 3000 BCE- Germanic and Celtic tribes were brew it, though their version of it would be virtually unrecognizable, given that they'd add spices, nuts, herbs, various plants, narcotics, and honey, but they did not contain hops.
So to answer your question, "We don't really know, but it was probably whoever grew the first cereal grains and then left it in water." It'd take a very long time for people to discover what yeast was, and in the mean time there was a magic-like association between beer and it's production. Numerous ancient religions have gods and goddess devoted to alcohol.
Unless you want to ascribe to a fantastical, "ALIENS MUST HAVE TAUGHT US" or "GOD DID IT!" type explanation the only remaining way would be that such a drink was discovered on accident. Given that it just takes water, a carbohydrate rich food, mold, and time, it doesn't surprise me that it would eventually be discovered.
It is entirely possible that wine, or a similar fruit based alcohol was discovered first given that there's fewer required ingredients to ferment it over a beer and that harvesting of such foods was something humans were familiar with prior to sedentary life, and that beer was intentionally made with the idea that if it could be done with fruit, if you added, say, barley, to water you could re-create whatever it was, in their minds, that made wine.
To put it in perspective, just about every food staple of the ancient world has some preserved variation. Fruits would be dried, milk fermented into yogurt and cheese, meats got salted and dried and mildly fermented. It's not awfully surprising that with no knowledge of how the process worked, humans discovered beer.
But we're well into speculative territory at this point. There's no evidence to support any of this given that it's all dating to 10000 BCE - 6000 BCE or thereabouts.