Prosocial behavior refers to behaviors that benefit others, such as sharing, helping and cooperating. The development of prosocial behavior is an important part of adolescent socialization. Substantial literature has documented the important influence of parent-child attachment on prosocial behavior; however, little is known about the mediating and moderating mechanisms underlying this relation. In this study, guided by development system theories and attachment theory, a moderated mediation model was constructed to examine the effects and underlying mechanisms of family (parent-child attachment), individual (psychological capital) and peer (deviant peer affiliation) factors on adolescent prosocial behavior. Specifically, the present study examined whether parent–child attachment is indirectly related to prosocial behavior through psychological capital, and whether this indirect association is moderated by deviant peer affiliation. A total of 737 junior high school students (mean age = 13.92 years, SD = 0.73) participated in this study. They anonymously filled out questionnaires regarding parent-child attachment, psychological capital, deviant peer affiliation, and prosocial behavior. All the measures have good reliability and validity. After controlling for gender and age, the structural equation model showed that: (1) parent-child attachment had a positive effect on prosocial behavior; (2) the positive impact of parent-child attachment on prosocial behavior was mediated by psychological capital; and (3) the mediating effect of psychological capital was moderated by deviant peer affiliation. The indirect effect was stronger for adolescents with low deviant peer affiliation than for those with high deviant peer affiliation. These findings contribute to our understanding of how and when parent-child attachment affects adolescent prosocial behavior as viewed through the lenses of different subsystems of development system theories. On the one hand, psychological capital plays an important role in the association between parent-child attachment and prosocial behavior; therefore, more attention should be paid to psychological capital and parent-child attachment and their roles in improving adolescent prosocial behavior. On the other hand, junior high school students with more deviant peer affiliations may require more attention, because parent–child attachment has a weaker protective effect on them in comparison with students with fewer deviant peer affiliations. The cultivation of adolescent prosocial behavior should focus not only on the effects of family factors, peer factors, and individual factors separately, but also on the combined influence of those factors.