The attacker, Kabutops, uses Mud Shot. The defender, Golem, is weak to the ground-type fast move. Even though the CP of Kabutops is lower than that of the Golem, Kabutops has an advantage over the defender for the relationship of types.
To win a gym battle in Pokemon Go, type effectiveness is considered as more important than other factors, such as CP and stats.
The defende uses Rock Throw, a rock-type fast move.
Kabutops shoots Mud Shot continuously and rapidly although the required energy for special attack is charged.
Golem uses Earthquake, a ground-type charge move. However, the defender is defeated before its charge move hits the Kabutops.