This is believed to be due to air being pushed out of the gap between the lid and the toilet bowl by the water flow. When the toilet is flushed with the lid closed, the aerosol effect may be ...
If there's a problem with one of these parts, the flow of water into the toilet bowl will be restricted ... smells ...