  (Abridged) Using cosmological hydrodynamic simulations in combination with
analytic modeling, we show that the galaxy stellar mass-metallicity relation
(MZR) provides strong constraints on galactic outflows across cosmic time. We
compare three outflow models: No outflows, a "constant wind" (cw) model that
emulates the popular Dekel & Silk (1986) scenario, and a ``momentum-driven
wind" (vzw) model. We find that only the vzw scaling reproduces the observed
z~2 MZR's slope, amplitude, and scatter. Comparing our fully three-dimensional
simulations with a simple one-zone chemical evolution model, we find that the
MZR can be understood in terms of three parameters: (1) The equilibrium
metallicity Z_eq=y*SFR/ACC (where y=true yield), reflecting the enrichment
balance between star formation rate SFR and gas accretion rate ACC; (2) the
dilution time t_d=M_g/ACC, representing the timescale for a galaxy to return to
Z_eq after a metallicity-perturbing interaction; and (3) the blowout mass
M_blowout, which is the galaxy stellar mass above which winds can escape its
halo. When outflows with mass loading factor MLF are present, galaxies below
M_blowout obey Z_eq = y/(1+MLF), while above M_blowout, Z_eq->y. Our cw model
has M_blowout ~ 10^10 M_sun, which yields a sharp upturn in the MZR above this
scale and a flat MZR with large scatter below it, in strong disagreement with
observations. Our vzw model reproduces the observed Z_g \propto M_*^0.3 because
Z_eq \propto MLF^-1 \propto M_*^1/3 when MLF >> 1 (i.e. at low masses). The
flattening of the MZR at M_* > 10^10.5 M_sun observed by Tremonti et al. (2004)
reflects the mass scale where MLF~1, rather than a characteristic wind speed.
The tight observed MZR scatter is ensured when t_d<1 dynamical time, which is
only satisified at all masses and epochs in our momentum-driven wind model.
