No. The demonstration in question does not infringe upon the conservation of mass.
The law of conservation of mass states that mass cannot be created or destroyed in a chemical reaction; however, mass can change from one form to another during the process.
In this instance, although the remnants of the paper weigh 0.5 g compared to the original weight of 2.5 g, the ashes and gases produced during combustion account for the missing mass of the paper.
The portion that has been burnt has transformed into other states. If the gas and ashes are adequately contained, they will correspond to the weight of the original paper when added to the remaining paper.
The nitro groups exhibit a strong electron-withdrawing effect, facilitating nucleophilic substitution reactions where a substituent is replaced by a robust nucleophile like the methoxy group. The reaction's mechanism is illustrated below. The electron-withdrawing nature of the nitro group aids in the formation of the intermediate during the reaction as depicted.