Mass spectrometry ionises a sample and measures the mass-to-charge ratio of the resulting ions. For a peptide, an observed mass matching the theoretical mass calculated from its sequence is the standard evidence that the intended molecule is present.
Peptides are usually run by electrospray ionisation, which tends to produce multiply charged ions — the same molecule appearing at several m/z values according to how many protons it carries. The neutral mass is reconstructed from that series, so the raw spectrum rarely shows a single peak at the molecular weight.
Identity and purity are separate questions answered by separate methods. Mass spectrometry addresses what the compound is; HPLC addresses how much of the sample is that compound. Note also that mass alone cannot distinguish two peptides built from the same residues in a different order — same composition, same mass, different molecule — which is why sequence is the underlying question.