Is it possible to light a dynamite fuse (1880s, thereabouts) with the muzzle flash from a gunshot at close range, like if they were holding it in their hand.
Probably. It’s also, probably a moot point, because the gunshot might simply detonate the nitroglycerin, turning your character into 180lbs of pulled people pork.
So, dynamite is (or at least was) really simple stuff. You had a mix of nitroglycerin and soft clay (though, other materials were used in some cases), wrapped, and with a fuse going in. Depending on the dynamite somewhere between 20% and 60% of the stick’s mass would be nitroglycerin. The clay? That’s only there to keep the stick from detonating spontaneously because you looked at it funny (or, more realistically, if you dropped it, or, say, fired a gun next to it.) You’d saturate the clay in nitroglycerin, and then wrap the whole thing up. The result is an almost stable version of a hilariously unstable explosive.
This is also why the concept of “sweating” or “leaking” dynamite is so dangerous. That’s the nitroglycerin seeping out of the absorbent medium, reforming in crystalline form on the outside of the tube, and dropping that will release enough energy to detonate it, which will in turn detonate the entire stick.
In very abstract terms, explosives are simply a chemical way to store energy. When you put energy in, you get that stored energy back out. Kind of like a battery… if your batteries decide they want to release their entire stored charge in an almost instantaneous reaction reducing everything in their immediate vicinity to shrapnel and paste. The more energy you need to put into an explosive to get it to detonate the more “stable,” it is, and generally speaking, the safer it is to handle.
On one end of the spectrum, you have things like plastic explosives which require very specific energy triggers to detonate, and can, otherwise, be safely mishandled to your heart’s content.
On the other end, you have things like nitroglycerin, picric acid, or fulminated mercury, which will wreck your day if you drop them. In particular, all three of those examples are entirely happy to release their energy (and explode) if you apply small amounts of kinetic energy to them.
Historically, the problem with nitroglycerin was that it was too unstable for use as an explosive. Alfred Nobel’s contribution to explosives was finding a way to stabilize the stuff enough that it could be stored and transported safely.
Not, “shot at safely.”
Gunpowder is another uncontrolled energy release. Particularly with black powder firearms there’s a lot of flaming material getting ejected from the gun barrel at high speed. Now, that can light a fuse (potentially), though it’s not 100%. Goofy as it sounds, you can miss, because the burning particles are getting scattered across an area, it’s not a literal cone of fire.
Now, I was talking about nitroglycerin being incredibly sensitive to kinetic shock earlier, thing is, this is a chemical that will detonate if you set it on fire (or heat it up to about 50 degrees Celsius (122F.)) Gunpowder burns at somewhere between 300C and 470C. (That’s specifically black powder, smokeless powders run somewhere around 1850C most of the time.)
Now, convection shouldn’t be quite fast enough to cause it to automatically detonate because it was in the vicinity of a gunshot (though sticking the barrel next to the fuse would almost certainly cause intimidate ignition), but if any powder residue lands on the stick, which isn’t out of the question, that stuff will be burning through the wrapper at more than six times the boiling point of nitro. The stick will go off before the fuse burns down, probably before your character can throw it, and hitting the stick is, ironically, more likely than hitting the fuse because it’s a larger target. (Also, burning powder will usually get ejected around 1-1.5m from the gun barrel, so maybe exercise some trigger discipline around dynamite.)
So, in short, yeah, you could certainly set off a stick of dynamite with a gunshot. Probably not exactly how your character was planning to, however.
I realize it didn’t come up, but putting a round into a stick of dynamite at, pretty much, any range will set it off. That’s more than enough kinetic energy to get nitroglycerin’s party started.