A public good is a good that is nonexcludable and nonrivalous. A nonexcludable good is a good for which it is impossible or extremely cosfly to exclude nonpayers from consumption. A nonrivalous good is a good for which availability is unaffected by an individual's consumption.
Government can provide a public good more effectively than the private market.
It is costly to exclude people from the benefit of a public good. A private supplier would have to identify individuals benefiting from the good and then charge them according to the benefit received. Government receives payment for provision of the good through taxation. With private provision of the public good there may be privacy costs involved in monitoring use of the good. A private supplier would provide too little of the good.