This idiom comes from a poem by the Song Dynasty poet Lu You (
陆游), describing a journey through mountains:
山重水复疑无路,
柳暗花明又一村 — 'Mountains overlap, rivers wind, one fears there's no road; then willows are dark, flowers bright, and another village appears.'
峰回路转 captures that same moment of unexpected hope.