@gollum,
The origin is English Common Law.
On the one hand you can understand why the King would be all for preventing his subjects from suing him, and on the other you should be able to understand why the "Sovereign" or the "State" cannot be constricted by the lawsuits of citizens.
Government would come to a grinding halt if any citizen could sue it for it's decisions or actions. It a practical matter, and practicality has always and always should be a consideration of the judiciary.
There is a reason why Common Law has endured, larely intact, for centuries.
Actually, whenever legislatures have attempted to meddle with it, it usually fucks things up royally.
I.e Dram Shop Laws.