The digestion(break down of food into nutrients) releasses gases which collects in your intenstines. When it gets crowded, the body tries to push them out.
No. Flatulence is produced by gasses built up within the intestinal tract. Just as you cannot get hiccups from being near someone with hiccups, passing gas is not mimicked by proximity. Yawns...