At the point when you enjoy a hearty chuckle, little drops of spit can enter your upper respiratory framework.
The body doesn't care for this occurrence as any 'unfamiliar substance' in your aviation routes carries with it the danger of a chest disease, so the hack reflex is set off to eliminate it from your respiratory framework.