The usual answer, of course, is: To clean themselves. There are other answers:
Some people think it is used as a way to control their temperature - it keeps their fur smooth, which in the winter traps heat. In the summer, it spreads saliva on the fur and cools them down and can also loosen fur so that they shed more easily. Others think it is a natural way of reducing parasites like fleas or ticks.
Perhaps cats lick themselves to ingest more foreign bacteria and dirt, which they need to be healthy. Test of this proposal: Feed a cat more fermented food, it should lick itself less. (Just as I became less of a foodie when I ate more fermented food.)