It's a problem for thousands of teenage boys and punchline fodder for every teen comedy. As boys go through puberty their voices begin to unexpectedly crack.
The reason for this is pretty straightforward, as the Today I Found Out YouTube channel explains in the video above. During puberty, young men get deeper voices. That is the result of the lengthening of the cartilage in the larynx, the growth of chambers in the head where the voice resonates, and the thickening of the vocal cords. These growth spurts help deepen the voice, in the same fashion that the sound of a guitar string gets deeper the thicker and longer the string becomes.