Binyavanga Wainaina, the acclaimed Kenyan author who inspired a generation of writers and became one of the most prominent Africans ever to publicly identify as gay, died on Tuesday in Nairobi. He was 48.
His brother, James Wainaina, said he died at a hospital after a short illness. A specific cause was not given.
Mr. Wainaina, an author, publisher, journalist and commentator, was seen as one of the most important voices in African literature. He won the Caine Prize for African Writing in 2002 and went on to establish Kwani?, a literary magazine that offered a platform for new Kenyan writers.
His essay “How to Write About Africa,” published in the British literary journal Granta in 2005, became a minor sensation, offering a biting critique of foreign journalists’ and authors’ clichéd approach to covering the continent.
“Treat Africa as if it were one country,” he wrote in the essay, saying that the characters must include “the Starving African, who wanders the refugee camp nearly naked, and waits for the benevolence of the West.”
“She must look utterly helpless,” he added.
As his success grew, Mr. Wainaina privately grappled with his sexuality. In 2014, he published what he described as a “lost chapter” from his life story. An intensely personal essay, titled “I am a homosexual, Mum,” it describes an imagined conversation with his mother before she died in 2000.
The essay drew strong reaction in Africa, where same-sex relationships are widely prohibited and can be punished with prison time in several countries.
Named one of Time magazine’s 100 most influential people in 2014, Mr. Wainaina was honored by the Nigerian author Chimamanda Ngozi Adichie.
“By publicly and courageously declaring that he is a gay African,” Ms. Adichie wrote, “Binyavanga has demystified and humanized homosexuality and begun a necessary conversation that can no longer be about the ‘faceless other.’ ”
Kenneth Binyavanga Wainaina was born in Nakuru, Kenya, on Jan. 18, 1971. His mother, Rosemary (Binyavanga) Wainaina, ran a hair salon there, and his father, Job, was a successful executive.
His family called him Ken, but the “exotic” name Binyavanga “gave me a thrill,” he said in an interview with The New York Times in 2014, and he began going by his middle name.
In 2011, Mr. Wainaina published a memoir, “One Day I Will Write About This Place,” which was a critical success at home and abroad. Readers noticed the absence of a love life, he said, but at the time, he thought, “I’m not ready to go there.”
By 2014, after ruminating for several months about whether to come out publicly, he published the “lost chapter” from his memoir online. In the essay, he described knowing he was gay since he was a young boy, but secretly struggling with that awareness for years.
“This feeling has made me suddenly ripped apart and lonely,” he wrote of the experience of shaking a man’s hand at age 7. “The feeling is not sexual. It is certain. It is overwhelming. It wants to make a home. It comes every few months like a bout of malaria and leaves me shaken for days, and confused for months. I do nothing about it.”
He began exploring his sexuality after his mother’s death. But he could not “say the word gay” until he was 39, he wrote, and he did not publish the “lost chapter” essay until he was in his 40s, after both his parents had died.
On World AIDS Day in 2016, Mr. Wainaina announced on Twitter that he was H.I.V. positive — “and happy,” he wrote.
He proposed to his partner last year. “I am beside myself with excitement that he has agreed to spend the rest of his life with me,” Mr. Wainaina wrote on Twitter at the time.
The couple were scheduled to marry this year, according to the Caine Prize.
Besides his brother, he is survived by his sisters, June and Melissa.
His death drew tributes from across the literary and artistic worlds.
Somi, a singer of Rwandan and Ugandan descent who was friends with Mr. Wainaina for more than a decade, described him as “a pioneer, in so many senses, in so many different spaces.”
His activism, and in particular his message in “How to Write About Africa,” she said, offered “a necessary call to arms in disrupting the Western gaze of African stories.”
Ellah Wakatama Allfrey, a trustee of the Caine Prize and the publishing director of the independent Indigo Press, praised Mr. Wainaina for “the wings he gave to a generation of writers.”
“Unflagging in his generosity, unflinching and direct in his criticism,” she said, “he produced work in his short life that will have impact longer lasting than those whose time here is twice as long.”