Symbiosis between soybean (Glycine max) and rhizobia is essential for efficient nitrogen fixation. Rhizobial effectors secreted through the type-III secretion system are key for mediating the interactions between plants and rhizobia, but the molecular mechanism remains largely unknown. Here, our genome-wide association study for nodule number identified G. max Nodule Number Locus 1 (GmNNL1), which encodes a new R protein. GmNNL1 directly interacts with the nodulation outer protein P (NopP) effector from Bradyrhizobium USDA110 to trigger immunity and inhibit nodulation through root hair infection. The insertion of a 179 bp short interspersed nuclear element (SINE)-like transposon into GmNNL1 leads to the loss of function of GmNNL1, enabling bradyrhizobia to successfully nodulate soybeans through the root hair infection route and enhancing nitrogen fixation. Our findings provide important insights into the coevolution of soybean-bradyrhizobia compatibility and offer a way to design new legume-rhizobia interactions for efficient symbiotic nitrogen fixation.