The origin of the Oktoberfest is the wedding of Crown Prince Ludwig -- later King Ludwig I -- to Princess Therese of Saxe-Hildburghausen on October 12, 1810. It became a public wedding when they invited the citizens of Munich to the royal event and closed the ceremonies with a horse race. Due to its popularity it was decided that more such races would be held, and the annual custom began.
As with all public events food vendors joined in and the races continued to be held at the date of the wedding anniversary. Agricultural shows and various competitions took place and food and beer booths were joined by musicians. Due to the large numbers attending, the booths soon expanded into tents.
Beer has always been a part of the festival, especially since the breweries began their parade in 1887, but it was never central to the festivities. So as such the Oktoberfest is no beer fest, but a wedding anniversary.
It also is celebrated usually in September, ending on the 2nd of October. Therefor, while it is generally known as the 'Oktoberfest', it is actually referred to by Bavarians as the Wiesn.
The Theresienwiese where the event is held