"The reactants are at a lower energy level compared to the products—as shown in the energy diagram. Since we are forcing the reaction in the forward direction towards more unstable entities, overall ΔH for the reaction is positive, i.e., energy is absorbed from the surroundings."
If your asking why they are different because atoms are rearranged in a chemical reaction, there must be the same number of sodium atoms and chlorine atoms in both reactants and products for them to be the same.