Nutrient limitation determines the primary production and species composition of many ecosystems. Here we apply an adaptive dynamics approach to investigate evolution of the ecological stoichiometry of primary producers and its implications for plant-herbivore interactions. The model predicts a trade-off between the competitive ability and grazing susceptibility of primary producers, driven by changes in their nutrient uptake rates. High nutrient uptake rates enhance the competitiveness of primary producers but also increase their nutritional quality for herbivores. This trade-off enables coexistence of nutrient exploiters and grazing avoiders. If herbivores are not selective, evolution favors runaway selection toward high nutrient uptake rates of the primary producers. However, if herbivores select nutritious food, the model predicts an evolutionarily stable strategy with lower nutrient uptake rates. When the model is parameterized for phytoplankton and zooplankton, the evolutionary dynamics result in plant-herbivore oscillations at ecological timescales, especially in environments with high nutrient availability and low selectivity of the herbivores. High herbivore selectivity stabilizes the community dynamics. These model predictions show that evolution permits nonequilibrium dynamics in plant-herbivore communities and shed new light on the evolutionary forces that shape the ecological stoichiometry of primary producers.