Altruistic behavior varies considerably across people and decision contexts. The relevant computational and motivational mechanisms that underlie its heterogeneity, however, are poorly understood. Using a charitable giving task together with multivariate decoding techniques, we identified three distinct psychological mechanisms underlying altruistic decision-making (empathy, perspective taking, and attentional reorienting) and linked them to dissociable neural computations. Neural responses in the anterior insula (AI) (but not temporoparietal junction [TPJ]) encoded trial-wise empathy for beneficiaries, whereas the TPJ (but not AI) predicted the degree of perspective taking. Importantly, the relative influence of both socio-cognitive processes differed across individuals: participants whose donation behavior was heavily influenced by affective empathy exhibited higher predictive accuracies for generosity in AI, whereas those who strongly relied on cognitive perspective taking showed improved predictions of generous donations in TPJ. Furthermore, subject-specific contributions of both processes for donations were reflected in participants' empathy and perspective taking responses in a separate fMRI task (EmpaToM), suggesting that process-specific inputs into altruistic choices may reflect participants' general propensity to either empathize or mentalize. Finally, using independent attention task data, we identified shared neural codes for attentional reorienting and generous donations in the posterior superior temporal sulcus, suggesting that domain-general attention shifts also contribute to generous behavior (but not in TPJ or AI). Overall, our findings demonstrate highly specific roles of AI for affective empathy and TPJ for cognitive perspective taking as precursors of prosocial behavior and suggest that these discrete routes of social cognition differentially drive intraindividual and interindividual differences in altruistic behavior.