Plants need nutrients the same as humans. Nitrogen is one of the primary macronutrients. Rain washes it away over time so it needs to be renewed.
Legumes, like peas, form a mutually beneficial relationship with a bacteria that colonizes its roots. The bacteria (called rhizobia) take nitrogen from the air, convert it into a usable form which the pea uses to grow and to compete with other plants. The bacteria feed on the sugars the plan produces and both thrive.
Nitrogen is used by plants for green, leafy growth.
It is widely believed that when the pea plant dies the bacteria continue to produce nitrogen in plant usable form and that growing legumes before the leafy, greens of the brassica family, like winter cabbage, adds a nitrogen supply to the soil.
This is why we leave the roots of legumes in the soil after harvest and dig over in autumn.