A gas exerts pressure on the walls of the container because:
In the gaseous state, the particles move randomly at high speed. Due to this random movement, the particles hit each other and also the walls of the container. The pressure exerted by the gas is because of this force exerted by the gaseous particles per unit area on the walls of the container.