Liquid and solid waste in the tanks generate gas. Gases are generated by radiation (radiolysis) or by decomposing organic chemicals that are mixed in the waste. Read more.
The gases can be dissolved in the liquid waste (similar to a carbonated soda) or exist as tiny bubbles. Gases slowly move (diffuse) through the waste and into the tank airspace (headspace). Read more.
Gas release into the tank headspace can dramatically increase when the waste is disturbed during activities such as waste retrievals (like stirring carbonated soda). How gases move from the tank headspace and into the outside air depends on if the tank is actively ventilated with an exhauster or if the tank is passively ventilated.