Diverse processes rely on the viscous flow of polymer solutions through porous media. In many cases, the macroscopic flow resistance abruptly increases above a threshold flow rate in a porous medium---but not in bulk solution. The reason why has been a puzzle for over half a century. Here, by directly visualizing the flow in a transparent 3D porous medium, we demonstrate that this anomalous increase is due to the onset of an elastic instability. We establish that the energy dissipated by the unstable flow fluctuations, which vary across pores, generates the anomalous increase in flow resistance through the entire medium. Thus, by linking the pore-scale onset of unstable flow to macroscopic transport, our work provides generally-applicable guidelines for predicting and controlling polymer solution flows.