Why does a gas exert pressure on walls of the container?
Because particles of gas hit the walls of container.
In gaseous state, the particles move randomly. So, sometimes they hit each other and the walls of the container. The pressure exerted by the gas is because of the force exerted by the gas particles on the walls of the container.