WASHINGTON — The first time Barack Obama visited Kenya, the land of his father, he was hoping to fill “a great emptiness” he felt inside, to figure out who he was and where he fit in the world.

He was met at the airport by a half sister and an aunt. “Welcome home,” the aunt told him. The three squeezed into an old Volkswagen Beetle, whose muffler fell off during the drive into Nairobi. As the aunt got out to go to work, she admonished Mr. Obama not to “get lost again.”

Twenty-eight years later, he leaves on Thursday to return to Kenya as the president of the United States with an entourage of hundreds and a long motorcade that includes an armored car with a working muffler. Any question of where he fits in the world has long since been answered. But how Kenya fits into his own identity remains one of the enduring questions of his presidency.

Through more than six years in office for Mr. Obama, Kenya has been a complicated part of his political persona. Known for a youthful memoir exploring his Kenyan roots, Mr. Obama has been celebrated as a son of Africa who reached the pinnacle of power. But he also found himself besieged by a conspiracy theory that he had actually been born in Kenya and was therefore ineligible to be president — a theory he felt compelled to dispel by marching into the White House briefing room in 2011 with his birth certificate from Hawaii.