Recent evidence has linked testosterone, a major sex hormone, to selfishness in economic decision-making. Here, we aimed to investigate the neural mechanisms through which testosterone reduces generosity by combining functional MRI with pharmacological manipulation among healthy young males in a double-blind, placebo-controlled, between-subject design. After testosterone or placebo gel administration, participants performed a social discounting task in which they chose between selfish options (benefiting only the participant) and generous options (providing also some benefit to another person at a particular social distance). At the behavioral level, testosterone reduced generosity compared to the placebo. At the neural level (n = 60), the temporoparietal junction (TPJ) encoded the other-regarding value of the generous option during generous choices, and this effect was attenuated by testosterone, suggesting that testosterone reduced the consideration of other’s welfare as underpinned by TPJ activity. Moreover, TPJ activity more strongly reflected individual differences in generosity in the placebo than the testosterone group. Furthermore, testosterone weakened the relation between the other-regarding value of generous decisions and connectivity between the TPJ and a region extending from the insula into the striatum. Together, these findings suggest that a network encompassing both cortical and subcortical components underpins the effects of testosterone on social preferences.