Although there are bacteria involved with bloat, the real cause is usually some kind of stress, that compromises a fishes immune system.
There are so many possibilities, but there are some common norms.
Too small a tank for type/size fish, the fish is being picked on by others, water quality (ie too high nitrates, not enough water changes, wrong water type, for type fish) overfeeding, over stocking, not enough cover, too high or too low temp for the species, the list goes on and on.