Either in microlevel organizations or macrolevel societies, the individuals acquire benefits or payoffs by forming interdependency groups linked by common interests. Conducting research on the effects of interdependency groups on the evolution of cooperation could have a better understanding of the social dilemma problem. In this paper, we studied a spatial public goods game with nonlocal interdependency groups where each of participants is located in a two‐dimensional square lattice or Watts–Strogatz small‐world network with payoffs obtaining from the interactions with nearest neighbors. In terms of the enhancement factor, the effects of group density on the evolutionary cooperation can be quite different. For a low enhancement factor, the cooperation level is a nonmonotonic function with the varying density of interdependency groups in the system, which means a proper density of interdependency groups can best promote the cooperative level. For a moderate enhancement factor, a higher density of interdependency groups can always correspond to a higher cooperative level. However, if the enhancement factor is too high, a high density of interdependency groups can impede the evolutionary cooperation. We give the explanations for the different roles of group density of interdependency by using the transition probabilities of C players into D players as well as the reverse. Our findings are very helpful for the understanding of emergence cooperation as well as the cooperation regulation in the selfish individuals.