Balancing Revenues And Expenditures Over Time
The primary reason for a sovereign wealth fund, just as for individual firms and businesses is to save now when it is possible to do so without undue pain in the form of reduced consumption, in order to facilitate greater future spending.
Saving first and spending later makes compound interest for an entity that can in principle live forever, work in the country's favor. This is an alternative to borrowing first with sovereign debt and repaying it over time, which causes the country to have to pay interest and also also risks default with the consequence usually being a foreign creditor imposed change in domestic fiscal policies often called an "austerity plan" (e.g. as happened in Greece not so long ago).
Typically, sovereign wealth funds are established when a government has more revenue than it reasonably needs to expend at the current time, and further anticipates future needs for which it is reserving funds, or anticipated that its current revenues may not be unsustainable.
The most common reason to create a sovereign wealth fund is when a country has currently high natural resource income (most often from the exploitation of, or taxation of exploitation of, oil and gas resources), which are finite in supply.
For example, the U.S. State of Alaska, most of the Middle East and North African oil rich countries, and some other countries with oil and gas wealth like Norway, have them. The goal in this case is primarily to extend the prosperity arising from current oil and gas revenues that are large relative to the current population, so that this prosperity can continue even when the oil and gas reserves dry up.
Another reason to create smaller sovereign wealth funds is to create a "rainy day fund". Most governments see excess revenue and reduced transfer payment driven expenditures during economic expansion portion of the business cycle, and reduced revenue and increased transfer payment driven expenditures during recessions. If there is a "rainy day fund" created in expansion portions of the business cycle, government borrowing will not be necessary to stabilize necessary or desirable spending during recessions. Not adjusting taxing and spending policies during a short term boom portion of the business cycle also promotes stability in taxing and spending policies that can enhance confidence in the government.
If current revenue levels are anticipated to continue indefinitely, and there are no future anticipated needs of the country, a large sovereign wealth fund doesn't make sense, and instead, the country could just distribute funds to its citizens currently.
Also, if there is a temporary excess of revenue accompanied in a country that is not fully developed and needs to make infrastructure investments, usually, a country will want to make those investments in national infrastructure that will increase national productivity, before investing excess revenue in the financial markets.
Industrial Policy
A second reason to have a large sovereign wealth fund is to use is as an element of a country's industrial policy, investing funds in sectors of the private sector economy that promise to advance the vision that the country's rulers or the fund managers have for the future of the country, rather than in parts of the private sector that will lead the country in a direction that undermine that vision.
For example, a country who leaders were worried about climate change might prefer to have a sovereign wealth fund that invested in private sector businesses in the clean energy and energy conservation sectors, while abstaining from investing in fossil fuel companies. Failing to invest in fossil fuel companies when if those funds had been distributed to the people and invested by the people they might have chosen to invest in fossil fuel companies, could cause that sector to shrink or be less profitable going forwards due to scarce access to capital or higher costs of capital.
Alternatively, a country with a sovereign wealth fund could invest in private sector businesses for the purpose of having a say in the decision making of those businesses from a major shareholder's perspective.
These are options that public sector retirement funds in the U.S. (frequently managed by an elected state treasurer) often utilize.
Conventional wisdom in Western capitalist countries is that private investors, on balance, make better investment decisions than government policy makers. So, in these countries, there is often a preference for investing sovereign wealth only in industry neutral securities, such as government treasury bonds, even though this means that the sovereign wealth itself won't earn great returns. Much of China's sovereign wealth, and the Social Security trust fund in the U.S., both of which are basically "rainy day funds" rather than being predicated on a specific planned loss of revenue, are managed in this manner, with a focus on mitigating risks of loss rather than on maximizing long term average returns.
Corruption
In a fair number of countries where political corruption is a problem, sovereign wealth funds are often used as a largely invisible to the outside world slush fund that can be used for nepotism by awarding loans and equity investments that would otherwise be poor commercial banking risks, or awarding high fee management contracts to allies and family.
More blatantly, in corrupt regimes, flat embezzlement of sovereign wealth for the personal use of corrupt leaders who control the funds, often not revealed until long after it happens, is not uncommon.