A gas can be squashed into a smaller volume. This is called compression. Gases can be compressed because their particles are far apart, so most of a gas is empty space. In a solid or a liquid the particles are already touching, so they cannot be pushed much closer, which is why solids and liquids are very hard to compress.
When the pressure on a gas increases, for example when you push in the plunger of a sealed syringe, the particles are pushed closer together and the gas is compressed into a smaller volume. The number of particles stays the same. Only the space between them changes.
When the pressure on the gas is reduced, the gas expands. Its particles move further apart and the gas takes up a larger volume. A gas also expands to fill any container it is put in, because there are no strong forces holding the particles together.