The exact origins of beer will forever be a mystery.
Our earliest relatives, back in the Paleolithic period, were hunters and gatherers. They foraged for food and scavenged or hunted meat. It wasn't until the Neolithic period, some 10,000 or so years ago, that people began to realize they didn't necessarily have to search for their food or even chase after it but instead could grow it themselves.
Their nomadic tribes became sedentary. They began farming and keeping livestock. They made pottery, built crude houses and organized themselves into more formalized groups in the Fertile Crescent, a region in the Middle East. It was the birthplace of the civilization we know today. And soon there was beer.