Over years, meaning has gradually extended from physical good health to psychological state of mind, in the sense of having good morale. I tell you here where it comes from.
The origin of this idiom
The origin of this expression, which is fairly recent (mid-20th century), is rather vague. Two different options may be possible:
In China, peach is the symbol of immortality.
For some, it comes from the fact that in the Chinese culture (the birthplace of peach trees), Taoist tradition more precisely, peach is the symbol of immortality. By extension immortality = good health = being in good shaped.
According to a very ancient legend and according to the poet Zhang Hua (in the 3rd century), the Queen Mother of the West (Xi Wang Mu) had in her orchard peach trees, with blossoms only every 3000 years. Their peaches had the power to give immortality to those who consumed them. At each rare harvest, the divinity had the opportunity to invite some simple mortals to a feast and offer these wonderful fruits.
And in the world of boxing:
The second origin would come from fighting sports and especially from the world of boxing. Peach and potato are two familiar words to describe a violent punch. Hence avoir la pèche / “having peach” and also avoir la patate (patate is the familiar word for pomme de terre / potato) / “having the potato” because you have to be in good shape and strong to hit hard. You may also hear avoir la frite “having the French frie !).
That’s about all I found for this idiom. What do you use in your country ?