"Hashem appeared to him in the Plains of Mamre while he was sitting at the entrance of the tent in the heat of the day." (Genesis 18:1)
Rashi says that Hashem brought the sun out of its sheath and made it shine intensely on this day, so that Avraham would not be troubled with guests and passersby. However, Hashem saw that Avraham was more aggrieved by the pain of not having guests than from his Bris Milah (circumcision), so therefore He brought angels to him in the form of men. The famous question asked here is: Why was Avraham so bent out of shape to do chesed (kindness) in this situation? Now, if someone had asked him for a favor, we’d understand his desire to respond favorably, even in his enfeebled condition. But in this instance, there was nobody in front of him asking for a favor or in need of his kind deed! And considering he had just performed a Bris Milah on himself … and that he was 99 years old … and it was then the hottest day in recorded history … why was it necessary for Avraham Aveinu to be up on his feet and involved with this?
R. Moshe Feinstein, ZTL (Darash Moshe) and R. Michel Barenbaum, ZTL (Sichos Mussar) and other classic Torah commentators answer along the following lines: Most people view chesed as something we do reactively, to respond to the need of a person in front of us. However, Avraham understood that for a Jew, the need to do chesed is something that arises from within and from an intense inner hunger to perform chesed. It is something the Jew needs for himself and his own ruchnius (spirituality)– irrespective of the need of the person in front of him! Without a doubt, the prime beneficiary of an act of chesed is always the giver. Just as a sick person doesn’t deny himself food because of his illness, so too Avraham didn’t cease to have a deep need to perform acts of kindness merely because of his physical pain and the discomfort of the day.
Understanding this Yesod (foundational principle) helps explain several anomalies concerning Avraham:For example, the Torah spends a good deal of space recounting for us Avraham’s hospitality towards the angels and his pleading on behalf of the residents of Sodom. Ironically, in both these instances, nobody benefited from his magnanimous deed, as the angels didn’t really eat his food, and his begging Hashem to spare Sodom was unsuccessful. The Torah is teaching us here that chesed is to be performed because it’s the right thing to do and because the Jew’s soul needs it … irrespective of the ‘results’ it brings about.
Another proof to this idea: In Genesis 18:5, Avraham says to the angels, “I will take a morsel of bread that you may nourish your heart.” Wouldn’t it have made more sense to say, “I will give” bread? The answer is that I will take is the most appropriate expression, because by performing his act of kindness, the benefactor is ‘taking,’ as he is satisfying his own spiritual need and requirement to bestow chesed. All of the above accords with many statements of Chazal (the Sages of the Talmud) such as Bava Basra 10a, “Hashem doesn't provide for the poor so we can be saved from Gehinnom,” and Vaykira Rabbah 34:8, “The poor man does more for the rich man than the rich man does for the poor.”