Guns don’t “accidently” go off. They are negligently fired.
He suffered from premature discharge of his weapon.
It happens, I guess.