Utility is not the same as consumer surplus. Consumer surplus is the difference between price an individuals pay and their individual reservation price.
Utility is a measure of gratification that can be completely different from consumer surplus and depending on what kind of utility we are talking about it might not even be possible to assign integer value to it. For example, with ordinal utility you can’t say some good gives you 20 utils from its consumption but with cardinal utility you can.
However, utility should be monotonically increasing function of consumer surplus so it is valid to say that at a point where total surplus is maximized also utility should be maximized.
Also producers also get utility because the higher producer surplus implies larger difference between actual price and their reservation price. Again utility should monotonically increasing function of this.