Why have international branch campuses? There are campuses in Malaysia belonging to the universities of Southampton, Nottingham and Reading.  There is a Mauritius branch belonging to Aberystwyth University, whereas the University of Wolverhampton has shut down its Mauritius campus.  Newcastle University has a Singapore campus.  There are many more examples of UK universities with campuses in Asia or Africa.

Why do (some) universities based in the UK spend resources on establishing a campus on another continent?  Is it a form of developmental aid, to bring UK expertise to a spot where existing universities may be perceived to have less quality?  Or is there a different reason?

I don't know if this is exclusive to the UK or if it also occurs with universities in other countries — I have not seen it anywhere else.

The Wikipedia article International branch campus is not terribly informative.
So focusing on the UK to start. The universities seem to be attempting to provide UK standard university education, but in more 'exciting' locations, increasing the number of students who study with them and their global reach.

Branch university campuses are in many ways a win-win-win phenomenon. For the university, they mean more students and stronger ties with other countries. For the host nation, they’re a quick way of boosting higher education standards and attracting more students, both local and international. As for students, the prime attraction has already been mentioned: a degree at an internationally ranked university, in a location where this was not previously possible. (1, 2, 3)

Back to the question of why universities are doing it?/getting involved?
It seems to be that these branch universities are risky and liable to fail.
This article is great and discusses many factors. It predominantly suggests that branches can be financially lucrative but they have a high risk of closure. As such, it concludes that prestige and a desire for international reach that are the main drivers, citing this report.
It is true that although financially risky, there are many sources of funding for these ventures, whether its tax breaks from the home country or incentives from the host region.

Nottingham's Malaysian campus has the benefit that it can apply for funding from more than one region. Doughty says: &quot;EU funding is quite interesting because we are viewed as both a UK and an Asian institution so we can pitch to whichever suits us best.&quot; 5

However I think this thesis offers the best view, these campuses are seen as new opportunities for universities otherwise limited to their own country.

Multiple factors contributed to Texas A&amp;M being poised and ready to accept the
opportunity to open an international branch campus: an invitation from a host country sponsor willing to cover all expenses, existing international ambitions, and strong support from the central administration.

These campuses predominantly provide undergraduate and masters degrees because tuition fees can cover the costs, but some campuses can provide highly specialised research centres for PhDs but it is usually not worthwhile undertaking research outside of the main multi-disciplinary hub of the home university unless the research is local to the branch because of isolation and funding.
NB: Other countries have these branch campuses:

There are currently over 240 international branch campuses around the world; many of these are located in the Persian Gulf region as well as (and increasingly) in Asia ...
71 countries hosting branch campuses – up from 53 in 2012;
30 “home countries” (i.e., originating countries) for branch campuses, up from 24 in 2012.