Due to the difficulty of denying national security to someone unwilling to pay for it, public goods like national defense are often supported by the government.
Why is it that government funding is typically used to support public goods like the national defense?
National Defense is one of the examples of the public good. If one individual in a particular location is protected against an attack or invasion by a foreign power, other people there are probably similarly protected. Due to the difficulty in charging for defense as a result, it suffers from the well-known free-rider issue. In fact, practically all economists are of the opinion that government action and taxation are the only ways to finance adequate defense.