Developed countries usually have reasons for providing foreign aid. One reason may be to keep a country stable. The foreign aid may help keep a country’s economy strong. When the economy is strong, people are less likely to revolt. If countries remain stable, it may help to keep a region stable.
Stability is a good thing for a developed country assuming it has a good relationship with the existing government. Usually, trade is involved, and the developed country doesn’t want to lose that trade by having an unfriendly government assume power. Additionally, the developed country may be using the country for military purposes. It may have bases in the country and would want to keep those bases there. In order to do that, it needs for the country to remain strong economically and stable politically.
Developed countries usually don’t give aid to other countries unless there will be some benefit to the developed country.