When the economy of a government is facing a deficit, why can't the government just increase the taxes to pay for its expenses? I've read that it should rather borrow money, because increasing the taxes would not solve the problem.
Firstly, a fiscal deficit is not very surprising. Governments normally want to keep its stock of liabilities (government-issued money and bonds) at least stable as a percentage of GDP. (This provides safe assets for the private sector.) Most economies normally have nominal GDP growing in steady state. The implication is that a steady state deficit is needed to grow government liabilities in line with nominal GDP.
If the deficit is larger than that steady state level, the debt/GDP ratio will rise, which is a concern for many people. The issue with rasing taxes to control this is that under any Keynesian model, the tax hike will reduce growth. This is unwelcome if the reason for the deficit was that growth was low.
Note that this is a politically controversial topic, so I just outlined the Keynesian objection (which is fairly standard), but I would note that not every economist would agree with the Keynesian assessment. There was a large debate about austerity policies (attempting to cut the deficit via cutting government spending) after the Financial Crisis. You could probably look up questions about austerity policies to get more information.