Polymer solutions are often injected in porous media for applications such as oil recovery and groundwater remediation. 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 in which the flow exhibits strong spatio-temporal fluctuations reminiscent of inertial turbulence, despite the vanishingly small Reynolds number. We find that the transition to unstable flow in each pore is continuous, arising due to the increased persistence of discrete bursts of instability above an onset flow rate; however, this onset value varies from pore to pore. Thus, unstable flow is spatially heterogeneous across the different pores of the medium, with unstable and laminar regions coexisting. Guided by these findings, we quantitatively establish that the energy dissipated by unstable pore-scale fluctuations generates the anomalous increase in flow resistance through the entire medium. Thus, by linking the onset of unstable flow at the pore scale to transport at the macroscale, our work provides generally-applicable guidelines for predicting and controlling polymer solution flows.