The Government has a very important role in the economy. The Government primarily has three different roles. It provides a properly functioning and well established legal and political system. The Government provides a regulatory framework for a competitive market to function. It stimulates a recessionary economy by increasing its spending. It tries to keep the income-inequality in check.
To know more about this topic read the full article here - https://www.elearnmarkets.com/blog/government-spending-affect-the-economy/