Mechanistic description of the transition from aerobic to anaerobic metabolism is necessary for diagnostic and predictive modeling of fixed nitrogen loss in anoxic marine zones (AMZs). In a metabolic model where diverse oxygen- and nitrogen-cycling microbial metabolisms are described by underlying redox chemical reactions, we predict a transition from strictly aerobic to predominantly anaerobic regimes as the outcome of ecological interactions along an oxygen gradient, obviating the need for prescribed critical oxygen concentrations. Competing aerobic and anaerobic metabolisms can coexist in anoxic conditions whether these metabolisms represent obligate or facultative populations. In the coexistence regime, relative rates of aerobic and anaerobic activity are determined by the ratio of oxygen to electron donor supply. The model simulates key characteristics of AMZs, such as the accumulation of nitrite and the sustainability of anammox at higher oxygen concentrations than denitrification, and articulates how microbial biomass concentrations relate to associated water column transformation rates as a function of redox stoichiometry and energetics. Incorporating the metabolic model into an idealized two-dimensional ocean circulation results in a simulated AMZ, in which a secondary chlorophyll maximum emerges from oxygen-limited grazing, and where vertical mixing and dispersal in the oxycline also contribute to metabolic co-occurrence. The modeling approach is mechanistic yet computationally economical and suitable for global change applications.