Stand back! I'm theoretically qualified to teach high school physics! Or will be soon...
Dakka's explanation looks pretty classy; I'm going to try to explain it with fewer words for the people who didn't take a few years or more of STEM subjects in college.
OK. Short form, spheres have
really shitty aerodynamics. Surprisingly so. The problem is that they're big and fat, so air piles up against the front of the sphere, slides a short distance along the sides, and then spreads out in a big fat wake. The wake is full of turbulence and vortexes, and churning up that air takes a lot of energy, which acts as a drag on the moving sphere.
Good aerodynamics come from having a steady flow of air
parallel to the surface of the object. Once the airflow isn't being sucked along the surface of the object, you get turbulence and drag.
One of the big ways we try to reduce drag is by making the sphere narrower, into a cigar or teardrop shape. That has obvious benefits, because the thinner object pushes aside less air, and the streamlined shape means air sticks to the back side of the object instead of creating lots of wake problems.
But you can't do that on a golf ball. What you CAN do is create controlled, small-scale turbulence along the surface- whirling, wobbling airflow. But with the right dimple depth, the slightly turbulent air will actually 'stick' to the dimpled surface better than a smooth airflow would stick to a smooth surface. Therefore, the ball creates less wake and less drag.
Note: Dimpling would not be helpful on a highly streamlined surface. It's most useful right around where you expect the airflow to 'peel off' a surface and turn into a wake.