To establish a charge on a molecule, an electron had to be removed; removal of that electron is effected through a collision, usually with a high-energy electron. During that collision, energy is transferred from the high-energy electron to the molecule, and that energy has to go somewhere. Part of it gets partitioned into various bond vibrations, so bonds start to vibrate quite a lot, until some of them snap completely. The molecular ion breaks apart and forms a fragment ion.
Individual molecules often fall apart during the mass spectrometry experiment. As a result, in addition to measuring the mass of an entire molecule, we also obtain the weights of various smaller pieces of the molecule. That may add some confusion to the data. However, these fragments provide an idea about what parts make up the whole molecule.