The dynamite-seeded log is not yet alight when Pete snatches it away from the fireman, so it would not have exploded when Pete threw it off the train. Dynamite, by its very nature, does not detonate unless it is actually set on fire or hit very hard in just the right way.
Exact same footage used in two scenes of the train climbing a grade prior to Pete's jumping aboard the locomotive from his horse.