Most commonly the pseudomonas bacteria is involved...but it can come from other bacteria too. There would likely have had to be a cut or injury to let the bacteria in.
When the chameleon gets mouth rot, unless its very very small, the lesion needs to be cleaned out by a vet, a culture and sensitivity test done to determine what antibiotic the chameleon will need to be put on to kill the bacteria. Pseudomonas is a very stubborn bacteria and an opportunist and will recur if not treated thoroughly.