(This applies to US beers...not sure about other countries.)
Most of us get our beer from the grocery store. But how did it get there? Let's follow a beer from birth...
1. A brewer somewhere (or a giant factory machine if you're buying "big beer") made your beer. It ended it's life in a giant fermentor tank. This is the freshest your beer will ever be.
2. It gets bottled or canned at the brewery. Bigger guys have a full on bottling line, which can cost anywhere from around $100k to millions, depending on the size. Smaller guys will have a mobile filling line rock up to the brewery, bottle everything, then drive off.
3. It's still pretty fresh at this stage; just bottled off the line. But now, it's off to the distributor. It's a legal requirement in most states for brewers to sell to distributors. They can't sell directly to retailers. This is starting to change in some states, but even then, it's often times necessary for a brewery to take advantage of the network of retailers that a distributor provides versus trying to hit the streets and sell beer one bar/store at a time.
So, it goes to the distributor, and it sits in a warehouse. At this point, it's getting warm. Warm temperature causes beer to go bad faster. Bigger breweries will pasteurize the beer to help mitigate this. It's debatable how much the pasteurization process itself affects the taste. They effectively super-heat the beer for a brief time to kill any yeast/bacteria that may have been alive in the bottle.
4. After sitting in a warehouse for a while; maybe a few days, maybe a few weeks...months...it goes on a truck to a retailer. Here...it sits...in a warehouse...again. Whenever the retailer decides there's space, the beer will make its way out to the floor. Sometimes it will go into a cooler, sometimes it will sit warm on a shelf. Again, it sits on the shelf for who knows how long, until you finally pick it up and put it in your cart.
By now, that delicious fresh beer that the brewery produced is probably a couple of months old, having been trucked around and stored in warm conditions before finally getting to your face. It likely was subjected to heat and light during transportation and the living components in the beer are fading, so the "fresh" taste is dulling.
The moral of the story? Support your local brewery! Nowadays, there are several in any major city and any small city has at least one. It's the only place you can walk in and get the FRESHEST beer, right out of the tanks, and taste the beer as it was intended to be tasted. Plus, they're starting to become social hangouts with great atmosphere, live music, games, food, etc. A great night out, then grab a couple of growlers to take home. (I've been informed that "growler" means something entirely different in the UK. Use caution when grabbing one of those. You may accidentally become president.)
The difference in taste is significant. If you buy beer from a local brewery at the store, do yourself a favor and taste that same beer fresh from the brewery. Mind...blown. You'll never want to drink old stale grocery store beer again.