If a Pokémon has a substitute, any damage the Pokémon would take from an opponent's moves is taken by the substitute instead. If the substitute runs out of HP or is hit by a one-hit KO move, it breaks. Other damage (except self-inflicted confusion damage), such as recoil damage or damage from status conditions, is not affected by a substitute.
Take the Substitute as a Pokemon, that has 25% of the Pokemon's Max HP. It takes hit for the Pokemon, until it gets faded upon its HP running out. In the replay you said, Excadrill did ~13% at burned to Dragapult with Rock Tomb.
4 Atk Mold Breaker burned Excadrill Rock Tomb vs. 0 HP / 0 Def Dragapult: 36-42 (11.3 - 13.2%) -- possibly the worst move ever
On Turn 2, Dragapult's Substitute took ~13% damage of its Max HP from a burned Rock Tomb. On the next turn, another Rock Tomb causes Dragapult's Substitute to fade. This would be because after a Rock Tomb, the Substitute had taken ~13% damage, or 1/8 of its Max HP. Another Rock Tomb causes ~13% more, summing up another ~13%, reaching ~26%, or 1/4 of its Max HP. Since a Substitute uses 1/4 of the user's Max HP, after taking more than ~25% damage would cause it to fade.
Does it accumulate damage over the times the sub was hit since it was first made or does the damage to it reset every turn?
The Substitute still stays in its place until it runs out of HP. It accumulates the damage taken previously, and not reset.
Hope this helps!