Ahmed was born in Kutubpur village under Kendua Upazila in Netrokona District to Foyzur Rahman Ahmed (1921–1971) and Ayesha Foyez (née Khatun) (1930–2014). Foyzur served as a sub-divisional police officer in Pirojpur District and was killed in 1971 during the Bangladesh Liberation War. In 2011, Politician Delwar Hossain Sayeedi was put on trial for the killing but was acquitted of the charge in 2013 due to a lack of evidence. Humayun's brother, Muhammad Zafar Iqbal, is a Writer and academician. Another brother, Ahsan Habib, became a Cartoonist. He had three sisters – Sufia Haider, Momtaz Shahid and Rukhsana Ahmed.
Ahmed studied in Chittagong Collegiate School. He eventually passed his Secondary School Certificate (SSC) examination from Bogra Zilla School in 1967 and was listed as second in merit by the Rajshahi Education Board. He passed his Higher Secondary School Certificate (HSC) examination from Dhaka College in 1969.
Ahmed wrote his debut novel Nondito Noroke (In Blissful Hell) during the 1971 Bangladesh independence war while he was still a university student. The novel was published in 1972 by Writer Ahmed Sofa's initiative under Khan Brother’s Publishers. From his very first novel, his themes included the aspirations of average middle-class urban families and portrayed quintessential moments of their lives. His second novel was Shonkhonil Karagar.
Ahmed married Gultekin Khan in 1976. Together they had three daughters, Nova, Shila and Bipasha, and one son, Nuhash. Shila Ahmed went on to become a television and film Actress. In 2003, Ahmed divorced Gultekin. He then married Actress Meher Afroz Shaon in 2005. He had two sons from the second marriage, Nishad and Ninit.
Ahmed's first television drama was Prothom Prohor (1983), directed by Nawazesh Ali Khan. His first drama serial was Ei Shob Din Ratri (1985). This was followed by the comedy series Bohubrihi (1988), the historical drama series Ayomoy (1988), the urban drama series Kothao Keu Nei (1990), Nokkhotrer Raat (1996), and Aaj Robibar (1999). In addition, he made single episode dramas, most notably Nimful.
In 1987, Ahmed founded an estate called Nuhash Palli, named after his son Nuhash, near Pijulia village, in Gazipur Sadar Upazila of Gazipur District, which grew to cover 40 bigha (approximately 14 acres). He would spend much of his time at the estate when he was in Bangladesh. He formed a collection of statues there by local Artist Asaduzzaman Khan and another of plants from around the world, particularly medicinal and fruit-bearing trees.
In the early 1990s, Ahmed emerged as a filmmaker. He went on to make a total of eight films - each based on his own novels. He received six Bangladesh National Film Awards in different categories for the films Daruchini Dwip, Aguner Poroshmoni and Ghetuputra Komola.
Shyamol Chhaya and Ghetuputra Kamola were selected as the Bangladeshi entry for the Academy Award for Best Foreign Language Film in 2006 and 2012 respectively, but were not nominated.
In 2009, Ahmed appeared as one of two judges for the reality television music competition show Khudey Gaanraaj.
Ahmed had open heart surgery at Mount Elizabeth Hospital in Singapore. A few years later, during a routine checkup, doctors found a cancerous tumor in his colon. On September 14, 2011, he was flown to Memorial Sloan–Kettering Cancer Center in New York City for treatment. During his stay there, he wrote a novel, Deyal, based on the life of the first President of Bangladesh Sheikh Mujibur Rahman. In January 2012, he was appointed as a senior special adviser of the Bangladesh Mission to the United Nations.
On May 12, 2012, he returned to Bangladesh for two weeks. He died on July 19, 2012 at 11.20 PM BST at Bellevue Hospital in New York City. There was some tension in the family over the selection of his burial site, but eventually his estate, Nuhash Palli was selected.
Exim Bank, a commercial bank and Anyadin, an entertainment magazine jointly introduced an award program, Humayun Ahmed Sahitya Puruskar, which would be conferred to two Writers every year on Ahmed's birth anniversary – November 12. The film Anil Bagchir Ekdin (2015), based on Ahmed's novel of the same name, directed by Morshedul Islam won six Bangladesh National Film Awards. Another film Krishnopokkho (2016), based on his novel, was directed by his wife Meher Afroz Shaon. In October 2016, she announced the production of the next film based on Ahmed's novel Nokkhotrer Raat. In June 2016, Government of Bangladesh approved a grant to produce a film based on his novel Devi.