Organisms that exploit different environments may experience a stochastic delay in adjusting their fitness when they switch habitats. We study two species whose fitness is determined by the species composition of the local environment, as they interact through a public good. We show that a delay in fitness adjustment can lead to coexistence of the two species in a metapopulation, although the faster growing species always wins in well-mixed competition experiments. Coexistence is favored over wide parameter ranges, and is independent of spatial clustering. It arises when individuals have different fitness values that can keep each other balanced.