All life forms have one essential purpose: survival. This is even more important than reproduction. After all, babies and grannies are alive but don't reproduce. To be alive is more than passing genes along.
Indeed, a sense of purpose appears to have evolved in humans so that we can accomplish big things together—which may be why it's associated with better physical and mental health. Purpose is adaptive, in an evolutionary sense. It helps both individuals and the species to survive.