There are two schools of thought about where beer originated.
Where Does Beer Come From - Theory A
The first group believes that beer was invented in 1516 in Germany when Bavarian Duke Wilhelm IV wrote the Reinheitsgetbot law, which decreed “forthwith that…in all our towns and markets and in the countryside no other items be used for beer than barley, hops, and water.” He didn’t include yeast in the law at the time because everyone still believed that God was responsible for the fermentation. The Reinheitsgetbot is considered the first food safety law ever written in the Western world and it marks the official beginning of what we all now understand to be beer - water, malt, hops and (of course) yeast.
Where Does Beer Come From - Theory B
The other school of thought believes that beer has kind of always existed. That beer is a part of human nature. That consuming fermented beverages is as natural and as healthy and as necessary as drinking water. This group believes that beer isn’t just malted barley, hops water and yeast. They have a much more broad, open-ended view of what it means to be beer.
Sam Calagione, founder of Dogfish Head Brewery, is a major proponent of this view of beer. Dogfish Head has made a whole series of beers called the Ancient Ales series that showcase the question of “where does beer come from?”. He has found recipes from all over the world that date back to 750 BC, 1200 BC and 7000 BC. These recipes use ingredients that were local to these times and places including honey, hawthorn fruit, rice, annatto tree seeds, and juniper berries boiled with hot rocks. You try putting a single annatto seed into a beer in Germany in 1516 and you’ll be thrown into the Zuchthaus.
If we take this second approach to what beer is, and where it came from then we can classify beer as the simple act of brewing and fermenting sugars which are mainly derived from cereal grains, most commonly from malted barley— though wheat, rye, maize (corn), rice, oats, or any grain that you happen to have on hand can work as well. Or honey. Or agave. Or maple syrup.
The act of brewing some sort of malted grain is basically as old as civilization itself, in fact some historians will argue that the agricultural revolution (which took place sometime between 9,000 B.C - 13,000 B.C, in The Fertile Crescent valley, which marks the beginning of civilization) was actually motivated by beer. (I might be a little biased here, considering how important I think beer is).
A very brief summary of where beer comes from in this time goes as follows:
Around 12,000 years ago groups of hunter-gatherers in The Fertile Crescent (around modern day Egypt and Israel) began to settle down into agrarian civilizations that were basically based around grain fields (rice, maize, barley, etc.). Then (probably) by accident they stumbled upon fermentation after they left their grain out in the rain and THAT is where beer comes from.
This discovery of early brewing could have been just the incentive that these people needed to propel them into what we now call the Neolithic Revolution by inspiring new agricultural technologies. From that point on, beer was a staple throughout society. It was used for religious ceremonies, as pay for workers, as a barter item, a social lubricant, etc... Beer has always held a major place in society.