"We share so many values, our common love for democracy, entrepreneurship, value for families. But there are some things we must admit we don't share, our culture, our societies don't accept," he told a frowning Mr Obama.
"It's very difficult to impose that on people that which they themselves do not accept. For Kenyans today the issue of gay rights is really a non-issue. We want to focus on other areas that are day-to-day living for people."
The tense exchange came during an unusually-frank press conference in which Mr Obama raised concerns about endemic corruption holding back the economic growth of Kenya, where his father was born.
"People aren't stupid," he said, calling for "visible prosecutions" of senior officials involved who were seen buying expensive houses or cars that should not be affordable on their salaries.
He vowed further American help in tackling Islamic militant group al-Shabaab but warned of the risk of the "marginalisation" of the ethnic Somali community by the often heavy-handed tactics of Kenyan security forces seeking to dampen the threat.
Mr Obama also explained his failure to visit his ancestral home until now, six years into his presidency, saying he "didn't want to play favourites" but admitting that International Criminal Court charges facing Mr Kenyatta over post-election violence in 2007 were of concern to the United States.
The ICC recently dropped the charges against Mr Kenyatta citing witness intimidation and a lack of evidence. Separate ICC charges still face his deputy, William Ruto.
Before Mr Obama's arrival, there had been questions whether he would meet Mr Ruto, who has waded into the homosexual debate by decrying the "dirty" practice.
Mr Obama shook Mr Ruto's hand during an unguarded moment at State House that was captured by the Kenyan presidency photographer and posted on Twitter.
Mr Obama's return to his father's homeland has been greeted with considerable enthusiasm, but there were concerns about how Kenya's long-lost son and its present leaders might navigate some difficult issues.
Nairobi was given a makeover nicknamed "ObamaCare" ahead of his arrival, with potholes filled, houses repainted and the clogging traffic for which the city is notorious banished from the streets.
Interviews with Mr Obama's relatives on his father's side, describing their excitement at his return "home" have dominated the airwaves.
At an entrepreneurship summit yesterday morning, his first speech in the country as the US president was watched by his paternal grandmother Sarah and half-sister Auma, escorted respectfully to their seats in the VIP section by presidential security.
The 53-year-old Mr Obama delighted his audience with a few phrases of greeting in Sheng, a youth slang which mixes English and Swahili, before adding: "Obviously this is personal for me. There's a reason why my name is Barack Hussein Obama. My father came from these parts and I have family and relatives here."
Mr Kenyatta urged him to return to America with the message that Kenya, and Africa, were no longer classified by "despair and indignity". "Share your experiences and let them know that Africa is open and ready for business," he said.
Mr Obama did his part to promote his father's birthplace, saying that travel warnings issued by his and other governments to their citizens were sometimes "exaggerated". He said: "My advice is come here and see for yourself."
But the security operation to keep Mr Obama's delegation safe from al-Shabaab, which recently killed 147 students at Garissa University and two years ago killed 67 people including Americans at the Westgate Mall in Nairobi, wiped out some efforts to spruce up the city.
Outside State House, stripy potted plants that dotted the pavement vanished overnight. Ebullient roadside hawkers selling American flags and crowds that turned out to greet Mr Obama were largely banned from the streets near his convoy. At Westgate Mall, security staff almost outnumbered visitors such was the concern that terrorists might attempt another attack.
Some critics questioned Mr Obama's willingness to make friends with Mr Kenyatta, whom he hugged as he emerged from Air Force One on Friday, pointing out that despite his pledges, the Kenyan president still presided over a deeply corrupt regime that has shown an intolerance of dissenting voices.
Boniface Mwangi, from the African Centre for Open Governance which is among a group of Non-Governmental Organisations Mr Obama will meet tomorrow, said Mr Kenyatta's pledges to tackle corruption and human rights abuses in return for more US financial support were purely "politically-expedient double speak".
"Kenya is known for its politicians promising things they never do," he said. "When Obama came here as the Illinois Senator 10 years ago he spoke about corruption and now he is back here having to say it again and it's even worse than it was." Eric Gitari, from the National Gay and Lesbian Human Rights Commission, said he was "surprised and shocked" by Mr Kenyatta's failure to condemn anti-gay violence and discrimination in Kenya.
"My heart just sank at his response," he said. "He made it into a question of African versus Western values but it's actually just about people's lives.
"I feel excluded in my own country. I am not a non-issue. It showed poor leadership."
Dr Adekeye Adebajo, from the Centre for Conflict Resolution in Cape Town, said Mr Obama's visit to his ancestral homeland was inevitably going to be nuanced. "The way Africa is often portrayed as either heaven or hell is very dangerous. No other continents would be analysed in that way," he said.