Because someone has to enforce the contract when a party breaks from their agreement or their is a dispute over whether the contract is enforceable. The courts are part of the government, by the way. And the police (also part of the government), help to enforce the court's decision. Oh, and the legislature has to be involved to ensure that certain types of contracts (one for child labor, for example) are void on their face.