Why does the Federal Government Sue?

That’s true, and it’s for the most part allowed by statute, defining the kinds of cases and liability consented to.

That’s in international law; par in parem non habet iudicium, so a state cannot be sued before the courts of another state (unless it is acting in a commercial rather than sovereign capacity). But within its own internal legal system, it is that system which decides whether a government can be sued before domestic courts, and American law says they can.

It’s not that simple. The 11th Amendment provides that states cannot be sued in the federal courts by individuals, due to sovereign immunity:

That means that the ability to sue a state in state courts is governed by state law, and the state gets to put conditions on when it can be sued in its own courts, as suggested by @Whack-a-Mole .

However, there is a simple way around the 11th Amendment to challenge state action in the federal courts: sue the state official who is charged with enforcing the state law in question.

For example, Ms Roe wanted to challenge the Texas state law prohibiting abortions. Because if the 11th Amendment, she couldn’t sue the state of Texas in federal court. So instead, she sued Wade, the District Attorney who would enforce the law. And Roe v Wade was en route to the Supreme Court.

So, Texas now passes their law so that no state official is charged with enforcing their anti-abortion law, so there is nobody to sue. Et voilá! They’ve found a way around the way around the 11th Amendment!

Another advantage of lawsuits is that along with damages, the court could impose a settlement that includes an injunction to stop doing something in future - or reach an out of court settlement to the same effect. It also establishes that certain behaviours violate the federal laws or statutes and so makes it easier to sue and impose even higher penalties next time - so hopefully stop people from behaving illegally. Also, financial penalties are the best incentive to modify the behaviour of corporations.

You can actually sue government officials in their official, as opposed to individual, capacities if what you are seeking is injunctive relief. The 11th Amendment does not prevent such a suit, because the state is not being held to answer for money damages.