The emp likely fries enough of the power supply unit that its safety protocols fail and BAM. Or causes shorts and an electrical fire which cooks off the ammunition or fuel it still has.
Really it makes about as much sense as causing enough physical damage to disable the machine causing it to explode as well. It could happen, it might not, it depends on the engineering involved (and there’s plenty suggesting that few shits were reserved for safety) and the current extent of damage to the machine.
Direction emp is still plenty good. Really, if whatever robot it is can explode strongly enough to pose a threat, and you were that close to it, it’s amazing you aren’t already dead. Playing emp grenade catch with a tank drone is tons of fun. And emp causing a detonation isn’t guaranteed, as I’ve seen robots just collapse plenty.