It's all in the stars...
In ancient Greece during the hottest time of the summer, the brightest star in the night sky was Sirius. Sirius is called the "Dog Star" and is the brightest of a set of stars which makes up the constellation Canis Major, "The Big Dog".
In addition, Sirius would rise and set in conjunction with our sun during what generally turned out to be the most sultry period of the summer (for that part of the world at least).
So because of the brightest star rising and setting as the sun did, the people of the time concluded that the dog star, Sirius, was heating our atmosphere on top of the radiation from our sun. Although this is not the reason for hot summer days, it sure sounds good, eh?
So, the 40 day period where Sirius and the sun were just about in phase with each other was referred to as "The Dog Days of Summer" Popularly, the term is just used loosely, as different parts of the world experience their dog days during different times of the year.
In fact, Sirius no longer rises during the summer. Thousands of years later, the dog star is in a different part of the sky relative to our view, and doesn't rise until fall/winter (northern hemisphere).