The mythological figure punished by eternal hunger and thirst just out of reach is Tantalus.
In the best-known version of the story, Tantalus stands in a pool beneath a fruit tree. Whenever he bends to drink, the water recedes; whenever he reaches for fruit, the branches move beyond his grasp. The punishment makes food and water visible but permanently unattainable.
Tantalus was usually described as a son of Zeus and the father of Pelops and Niobe. Ancient sources disagree about his offense: he may have revealed divine secrets, stolen ambrosia and nectar, or served his son Pelops to the gods at a banquet. The receding food and water are famous today, but early Greek writers also emphasized a stone perpetually hanging over his head.
His name produced the English verb “tantalize,” meaning to torment someone with something desirable that remains just out of reach. He is sometimes confused with Sisyphus, whose punishment involved repeatedly pushing a boulder uphill, or Ixion, who was bound to a fiery wheel.