The reason why golf balls have dimples is a story of natural selection. Originally, golf balls were smooth; but golfers noticed that older balls that were beat up with nicks, bumps and slices in the cover seemed to fly farther. Golfers, being golfers, naturally gravitate toward anything that gives them an advantage on the golf course, so old, beat-up balls became standard issue.

At some point, an aerodynamicist must have looked at this problem and realized that the nicks and cuts were acting as "turbulators" -- they induce turbulence in the layer of air next to the ball (the "boundary layer"). In some situations, a turbulent boundary layer reduces drag.

If you want to get deeper into the aerodynamics, there are two types of flow around an object: laminar and turbulent. Laminar flow has less drag, but it is also prone to a phenomenon called "separation." Once separation of a laminar boundary layer occurs, drag rises dramatically because of eddies that form in the gap. Turbulent flow has more drag initially but also better adhesion, and therefore is less prone to separation. Therefore, if the shape of an object is such that separation occurs easily, it is better to turbulate the boundary layer (at the slight cost of increased drag) in order to increase adhesion and reduce eddies (which means a significant reduction in drag). Dimples on golf balls turbulate the boundary layer.

The dimples on a golf ball are simply a formal, symmetrical way of creating the same turbulence in the boundary layer that nicks and cuts do.