He was piloting an ultralight he'd recently bought. The previous owner had modified it - being left-handed, he'd relocated the fuel reserve tank switch to the other side of the cockpit, and wedged it so the cock needed a wrench to turn it. Denver was right-handed and didn't have a wrench with him. He died still wrestling with the switch.
Valens, whose real name was Richard Steven Valenzuela, died in a plane crash the year following the release of this song. Also a passenger and victim on the same plane was Buddy Holly.