We still don't know why giraffes developed their long necks - and recently another hypothesis has emerged.

It would seem that even schoolchildren know that giraffes need a long neck in order to eat leaves high in the crowns of trees in the savannah. However, zoologists are not so sure about this: there are several hypotheses explaining the development of a 2–2, 5-meter neck, in addition to the one named above and proposed by Darwin.
Indeed, long-necked giraffes have been shown to live, as a rule, less than their short-necked counterparts. This feeds other hypotheses, such as the elongation of the neck as a result of sexual selection, as happened with the tails of peacocks or the horns of elk. The necks do serve as an important tool for male giraffes in fights for the female, but they can also contribute to a better view, helping to find food, spot predators, etc.
In total, at least six hypotheses are known about the origin of the long neck of giraffes, and recently Graham Mitchell of the University of Wyoming and his colleagues from Australia and South Africa substantiated another. In an article published in the Journal of Arid Environments, scientists point to the thermoregulatory benefits of such a neck in the hot, arid African savannah.
The authors note that lengthening the neck leads to an increase in the ratio of body surface to mass, facilitating the efficient transfer of excess heat into the surrounding space. To show this, they calculated the surface area of 60 giraffes of both sexes and different ages, weighing from 141 to 1358 kg. It was possible to find out that the relative ratio of area to body weight varies from 145 cm2/ kg for young animals up to 90 cm2/ kg in adults.
However, on average, the body surface of giraffes was 7.3 ± 2.5 m2, which is comparable to similar indicators in other animals of the same mass: the additional area created by the neck and long legs is compensated by a reduced head and body. But at the same time, both the legs and the neck have a relatively small diameter, which provides less heat from the sun's rays and increased efficiency of heat removal due to convection and evaporation.
All of this has led Mitchell and his colleagues to conclude that while a long neck does not provide giraffes with a gain in body surface area, it provides a more advantageous geometry that allows for effective thermoregulation in the African savannah.