Answer
For a mammal in particular, the GI tract is appealing to bacteria because it holds at a relatively constant temperature.
Work Step by Step
There are other general benefits to living in the alimentary canal of any organism, including easy access to nutrients, shelter from environmental changes, stable pH, and somewhat less competition with other bacteria.