Microbes often live in dense communities called biofilms, where competition between strains and species is fundamental to both evolution and community function. Although biofilms are commonly found in soil-like porous environments, the study of microbial interactions has largely focused on biofilms growing on flat, planar surfaces. Here, we use microfluidic experiments, mechanistic models, and game theory to study how porous media hydrodynamics can mediate competition between bacterial genotypes. Our experiments reveal a fundamental challenge faced by microbial strains that live in porous environments: cells that rapidly form biofilms tend to block their access to fluid flow and redirect resources to competitors. To understand how these dynamics influence the evolution of bacterial growth rates, we couple a model of flow–biofilm interaction with a game theory analysis. This investigation revealed that hydrodynamic interactions between competing genotypes give rise to an evolutionarily stable growth rate that stands in stark contrast with that observed in typical laboratory experiments: cells within a biofilm can outcompete other genotypes by growing more slowly. Our work reveals that hydrodynamics can profoundly affect how bacteria compete and evolve in porous environments, the habitat where most bacteria live.