Let me give you two specific government activities that come about because of market failures:
First, there is the provision of police protection. Police protection is, in general, a public good. It would be very hard to have a private police force that would only protect those who pay for the service (how would they do traffic patrols, for example). Therefore, the market will not provide this service and the government must.
Second, there are laws against firms polluting the environment. This is because pollution is an externality. If the government simply allowed pollution to happen, it would have impacts on people who did not even buy products from the firm that did the polluting. This is an example of a negative externality. To prevent this, government regulates the degree to which industries can pollute.