To keep the giraffe cool during hot days. The spots create air currents.
Camouflage maybe, though giraffes are fairly easy to spot. May be more about creating air currents, as is the case with the Zebra's stripes, the different colors absorb heat at different rates thus establishing air convection currents that keep the animal cool in the heat of the day.