The nature and origins of hominid intelligence is a much-studied and much-debated topic, of natural interest to humans as the most successful and intelligent hominid species.
There is no universally accepted definition of intelligence, one definition is "the ability to reason, plan, solve problems, think abstractly, comprehend ideas and language, and learn." The evolution of hominid intelligence can be traced over its course for the past 10 million years, and attributed to specific environmental challenges.
It is a misunderstanding of evolutionary theory, however, to see this as a necessary process, and an even greater misunderstanding to see it as one directed to a particular outcome.
There are primate species which have not evolved any greater degree of intelligence than they had 10 million years ago: this is because their particular environment has not demanded this particular adaptation of them.
Intelligence as an adaptation to the challenge of natural selection is no better or worse than any other adaptation, such as the speed of the cheetah or the venomous bite of the cobra.
It is, however, the only adaptation which has allowed a species to establish complete domination over the rest of the natural world.
Whether our species has yet acquired sufficient intelligence to manage this responsibility is a matter for debate.