Legumes are plants that could convert nitrogen from the air to a nutrient that it could use. The process of converting nitrogen to a nutrient useful to a plant is nitrogen fixation.
Not all plants has the ability to collect nutrients from the air. Actually most fruits and vegetables used in the kitchen are not legumes.
One of the problems in farming is that when you harvest nitrogen deficiency occurs. With this legumes play a big part in maintaining the nitrogen in the soil.
The next problem is though legumes can provide nitrogen to itself it cannot share it to the other plants. That’s why most legumes are treated as sacrificial plants because in order for the nitrogen collected by the legume to be available in the soil for other plants it should die and decay.
Fortunately, beans can be harvested first before you kill the plant.