Simethicone works as an anti-foaming agent. It decreases the surface tension of gas bubbles, causing them to combine into larger bubbles that can be more easily expelled. This mechanism provides relief from the discomfort associated with gas accumulation.