The formula in the book is correct. They are trying to get the change in internal energy per mole of sample. From the first law, for this constant volume system (no work), $$\Delta U_{total}=q=C\Delta T$$$$\Delta U_{\textrm{total}}=q=C\Delta T$$where C is the heat capacity of the calorimeter. This equation assumes that the heat capacity of the water in the bath is lumped into C, and that the temperature change of other parts of the calorimeter is the same as that of the water.
The number of moles of sample is m/M. So, $$\Delta U_{per\ mole}=\Delta U_{total}\frac{M}{m}=C\Delta T\frac{M}{m}$$$$\Delta U_{\textrm{per mole}}=\Delta U_{\textrm{total}}\frac{M}{m}=C\Delta T\frac{M}{m}$$In their notation, they use the symbol Q to represent the heat capacity of the calorimeter C.