There are two main reasons attributed to Tantalus's punishment, sources from theoi.com:
- He was invited to Olympus by Zeus, ate the food of the gods (ambrosia
and nectar), and was given divine secrets, which he then blabbed
(Hom. Od. xi. 582).
- He wanted to test the gods and see how perceptive they were, so he
invited them to his home for dinner, and killed his son Pelops and
cooked and served the boy to the gods. (Hygin. Fab. 83 ; Serv. ad
Aen. vi. 603, ad Georg. iii. 7.)
Theoi mentions other stories which I've never heard before, so I don't know how common they are (including one which says he fell in love with Zeus's cup-bearing boy Ganymede and carried him off!).
In any case, the punishment is that food and drink always seem to be within his grasp but are never attainable, and his two major sins both involved food which should not have been eaten.