Dogs play for the same reason all animals do (including us) - to develop good social skills, to build physical endurance and, well,
to have fun
There is nothing wrong with how your dog is trying to play with you - "keep away" is a very common game - but if it's not the way you want them to engage you teach them other games you want to play instead (i.e. tug, fetch, "find it" etc.)