"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)
Why was Avraham so insistent about his desire to do chesed (kindness) in this situation, despite the fact that there was nobody in need of his kindness or hospitality?Rav Mordechai Gifter, ZTL (Pirkei Torah) answers as follows:In Torah thought, there are two chief aspects to chesed: (1) V’ahatva L’reyacha K’mocha – the ‘love your fellow Jew as yourself’ component, and (2) V’holachto Bid’rochov – the requirement to imitate the ways and traits of G-d Himself. Rav Gifter explains that even when the “V’ahatva L’reyacha K’mocha” aspect of doing an act of kindness isn’t applicable – such as when Avraham is ostensibly trying to feed angels – nonetheless, the “V’holachto Bid’rochov” portion remains. And how does providing chesed imitate Hashem’s ways? Before the creation of the universe, there actually was no creature in need of Hashem’s kindness. Nonetheless, Hashem desired to bestow kindness … and so He created the world in order to satisfy His desire to bestow goodness anyway. Therefore, it emerges from here that a Jew must do much more than perform acts of chesed; he is required to also imitate the way in which Hashem does chesed.
As this pertains to Avraham, we see that even when there was no person in front of him with an active need to fulfill, he desired to perform an act of kindness anyway. This stemmed from his great desire to bestow goodness on another person, and this is derived from the obligation of V’holachto Bid’rochov. In response, Hashem perceived an altruistic desire for chesed that paralleled His own and thus sent the angels to Avraham so as to fulfill his wish!