This can be explained by law of conservation of momentum, which says total momentum in a system is conserved.
before the bursting of the cracker the total momentum is Zero. . hence after the burst its momentum needs to be Zero according to
law of conservation of momentum.hence the particles fly off in such a way that each one's momentum is nullified by the one flying off in opposite direction.