They are not spontaneously exploding
The drones are attacking as an overwhelming, densely-packed precisely synchronized swarm, performing intricate and coordinated maneuvers, en masse, in perfect harmony, at very high velocity.
As soon as that perfect coordination is disrupted they are going to start bumping and colliding with each other. Packed as tight as they are, moving as fast as they are, that's going to create a chain reaction of collisions.
EDIT: It is also possible that the close proximity to an exploding ship might cause another ship that close to explode, as well, and any combination of those two events throughout the swarm, but the specific quote provided by Valorum in his answer, where Spock references the disruption of coordination, suggests that collisions would be the main mechanism.