Sounds like you have a clog somewhere. If so, then this is causing the water from the tub trap to be sucked out, thus leaving a path for sewer gas to escape (no water left in the trap). When you flush, the water creates a vacuum - normally the air is replenished through the vent. If there is a clog, then it still has to get air somewhere - the closest place is the tub. It might be happening in the vanity sink, too, but that trap is higher, and probably has a different access to the vent system.