The government has sovereign immunity and can be sued only when it allows itself to be sued, such as under the Federal Tort Claims Act.
why would it ever let itself be sued
Because we have an elected government. If the government causes somebody a loss, voters, and by extension their representatives, and by extension, the government itself, wants to make them whole. Without allowing lawsuits, the only option is passing individual laws for each possible claim, and also creating a way to adjudicate those claims. We already have courts to handle the exact same kinds of issues between private parties. Congress decided to let it apply to the government too, when appropriate.
Because it is not yet an authoritarian state. Liberal democracies rarely live up to the high-minded ideals that underpin their political system but if the government excludes itself from the rule of law, it is no longer a liberal democracy.