A keg of beer can spoil. The spoilage does not make the beer harmful to drink, but it does significantly alter its flavor. Beer may spoil due to the growth of harmless bacteria or exposure to oxygen.
The alcohol in beer slows down the growth of bacteria, while oxygen speeds up the process. Oxygen also causes beer to go flat. Once tapped, a keg of beer will start to spoil in approximately 48 hours from the exposure to oxygen. Temperature can either slow down or speed up bacteria growth. Bacteria growth is facilitated by hot temps and hampered by cold ones.