Sometimes, good things can come out of sticky situations.
In the 1550s, German brewers were prohibited from making beer during the summer. The idea was to prevent brewery fires that had occurred in various places due to the combination of brewing techniques, materials, and hot summer weather.
As a result, breweries expanded their cellars to that there would be plenty of beer available during the summer. Often, to keep the cellars as cool as possible, they planted tall trees in the area to protect the building from the sun. Eventually they added benches and tables, and the beer garden was born.
In Bavaria, it quickly became popular to bring your own food to the beer gardens, or biergartens, while enjoying whatever brews were offered.
In the 19th century many Germans emigrated to the United States, and they brought the beer gardens with them. Considering that typical American bars and pubs were all indoor establishments, these new beer gardens quickly became a popular alternative. Additionally, many of these stateside gardens were built in the opulent architectural styles of the time, and featured beautiful decorations, making them a particularly enjoyable place to spend the weekend.
Unfortunately, as with several other leisure activities, Prohibition entirely halted beer garden culture. Even when it ended, many were slow to rebuild. Recently in the U.S. there has been something of a beer garden renaissance, with new ones opening in cities across the nation.