How do we know how to represent chemical reactions?
How else but by experiment?
Study a chemical reaction; identify reactants; take the mass of the reactants; do the experiment; and measure the mass of the products.
Are the product masses the same as the reactant masses? Well, routinely they are, and every chemical experiment demonstrates the principle.
Mass is always conserved in a chemical reaction.