Is there a way to replace a gas (air) for example with another gas (say, helium) in a gas chamber? It does not need to be a complete replacement, but there would need to be a significant amount of the new gas. Thanks!
Chemists who need to control which gases are in their vessels (e.g. those who work with air sensitive compounds) do this routinely.
There are two ways to achieve gas replacement. The more reliable way is to work with vacuum-lines that allow switching the input to a vessel between a vacuum and an inert gas. First the air is removed and then the inert gas introduced.
Often, though, this is overkill. In many cases where liquids are involved the liquid needs to be degassed (to remove air dissolved in the liquid). In many cases it is good enough to bubble the inert gas through the liquid and the vessel for long enough to sweep out the unwanted gases. Bubbling the inert gas through the liquid and allowing it to escape the vessel is good enough if done for long enough.
If it isn't important to remove all traces of the original gas, this is usually an effective technique and gets more effective the longer the inert gas is allowed to flow.
First you would need to know if the gas is denser than air or not. You would make two holes in the container, one in the top, the other in the bottom. For helium start pumping it in through the top. The air will be pushed out the bottom until the container contains only helium. The denser air will flow through the bottom and the helium remain at the top (to an extent). The container would then need to be resealed to ensure the gas stays. For a dense gas like C0$_2$, you would do the inverse, pumping through the bottom instead.
As a side note, it would take less gas to purge the container if you pumped it slowly, letting the gas settle in layers. Pumping it too fast would cause a turbulent flow, pushing out both gasses at once instead of just the one you wanted to get rid of.
The answer given by @matt_black is technically sound and is how chemists actually tackle this problem, but I wanted to add a clever answer (which I read somewhere and can't remember the source for unfortunately) that I saw which works for gloveboxes and other compartments where you can still manipulate things in the compartment. The idea is that you can fill balloons with your replacement gas, put them in the chamber, then purge only the space between balloons with the new gas. By decreasing the volume that must be purged, you use much less gas. Finally, pop the balloons.
I've wanted to do this for a while when rebuilding a glovebox, but haven't wanted to clean up all the popped balloons.