Because when you drain the bathtub, it has to force all the air out of the drain pipe. That air will go out of the system the easiest way. In most cases that would be out the pipe into the sewer or a vent pipe, but in some cases, it might be another drain, like a toilet.
Draining your bath tub causes your toilet to bubble because in many houses both the bath tub and the toilet drain through the same pipe. When you drain your bath tub, this pipe reaches capacity, causing water (and bubbles) to go where there is room, in this case, the toilet.
The toilet bubbles because it is connected to the same drain line as your bathtub. If the drain line is clogged or draining slowly, the water has nowhere to go, and since it shares a drain line it will filter back to your toilet. If the clog gets bad enough, your toilet will eventually back up.
This sound occurs when you have a blockage in plumbing pipe from your toilet to the sewer or septic tank and will hear it before a complete blockage occurs with an overflow from the toilet. You will need to snake your drain pipe to dislodge any blockage or call a plumber.