Governments provide all sorts of services. We can generally categorize the services they provide in two ways.
First, governments provide things that are called public goods. These are things that private companies could not provide because they would not be able to require people to pay for them. Police protection is an example of this. It would be very hard for a private police force to protect only those people who paid their bills. Instead, the government makes everyone pay taxes and then provides police protection. Similarly, the government provides things like national defense and clean air and water. These are other public goods.
Second, the government provides things that are beneficial to society. These are things like education. When the government pays to provide education, it helps society as a whole. It helps to create an educated populace that will be able to do things like having good jobs in the future. The government provides this sort of service because it feels that it is important to do so in order to improve society.
These are the two main types of services that the government provides.