The bacteria convert atmospheric nitrogen (N2) into an organic form that plants can use in a process called nitrogen fixation.
In turn, the bacteria obtain photosynthetic products from the plant.