Why are people allowed to go to courts against the government's decisions?

In a democracy, ail political institutions are formed for the welfare of the people. But sometimes, the actions of the government or a law passed by the government might hurt the public interest or might be against the spirit of the Constitution. In such cases, citizens have the right to go to court to get justice. Such cases are called Public Interest Litigations (PILs).
In case of violation of Fundamental Rights by the government, the citizen can go to the courts for justice. Then the courts intervene to prevent the misuse of power by the government.