The pressure exerted by the gas is because:
Particles of gas hit the walls of the containers.
Since particles of gases move in every possible direction, they continuously collide with other particles and also with the walls of the container. When the particles hit the wall, they exert an unbalanced force on the wall of the container. This force, when divided by area, gives pressure.