Oddly enough, alcohol abuse. It’s called esophageal varices.
It’s basically caused by veins in your esophagus rupturing. The same way you can have veins hemorrhage near your anus, causing hemorrhoids. In your esophagus, it’s usually caused by an enlarged liver putting pressure on the surrounding veins. And an enlarged liver is usually caused by end-stage alcoholism.
So the dude had an enlarged liver, (likely sue to a lifetime of alcohol abuse,) popped veins in his esophagus, and started coughing up massive amounts of blood. The dude likely wouldn’t have survived even if he was sitting in an ER when it happened. By the time it happens, it’s usually too late to fix; The victim will drown in their own blood before doctors have a chance to fix it.
But as a random onlooker with no idea what’s happening, it’s absolutely horrifying to see. It looks like something straight out the beginning of a zombie movie. Hell, even if you know exactly what’s happening, it’s still horrifying to see. But at least if you recognize it, you know it’s not contagious.
Source: Dated an EMT for a while, and she had a patient deal with one right after we started dating. I got morbidly curious, and regret the ensuing google searches.