Gani was born in Palembajan, West Sumatra, west of Bukittinggi, on 16 September 1905. The son of a teacher, he finished his early studies in Bukittinggi in 1923 before going to Batavia, first for his secondary studies and then to study medicine. He graduated from STOVIA, a school for prospective doctors, in 1926. From his teens Gani was active in politics and social organisations. He was a member of several groups for native youth, including Jong Java and Jong Sumatera. By the late 1920s he had several enterprises running, including a boarding house and book reseller. This revenue enabled him to donate funds to the Youth Congress of 1928, where the Youth Pledge was first read and "Indonesia Raya" was first played; Gani also attended this conference. In 1931 he joined Partindo, which had split off from the Indonesian National Party shortly after Sukarno's arrest by the colonial government. Gani became acquainted with Sukarno after the latter's release from prison the following year and joined the Indonesian Political Federation with him. Long interested in theatre, in 1941 Gani starred in Union Film's Asmara Moerni after being invited by the film's director, Rd. Ariffien. At the time the country's film industry was beginning to cater to well-educated audiences. Although some of the audience considered Gani's involvement in Asmara Moerni as besmirching the independence movement, Gani considered it necessary to improve how the people viewed local productions. The film, the only one Gani ever made, was a commercial success. That year Gani received his medical degree. After the Japanese occupied the Indies in 1942, Gani refused to collaborate. As such, he was arrested in September 1943 and held until October of the following year. He spent the rest of the occupation as a private practitioner.
National revolution
After the country's independence and during the ensuing revolution, Gani gained greater political power while also serving with the military. From 1945 to 1947 he was the commissioner for the PNI in South Sumatra, also serving on that party's board. He also coordinated military efforts in the province. He considered Palembang a viable economic powerhouse for the newly independent nation, arguing that with oil they could gather international support. He negotiated sales with international interests, including the Dutch-owned Shell while smuggling weapons and military supplies past the Dutch blockade. He had numerous connections in the Chinese community in Singapore, which assisted him in these tasks. From 2 October 1946 until 27 June 1947 Gani served as Minister of Welfare under Sutan Sjahrir in the prime minister's third cabinet; Sjahrir later remarked that he felt as if Gani had been imposed upon him by Sukarno, who was by then president. While serving as minister of welfare Gani, with Sjahrir and Mohammad Roem, served as the Indonesian delegation to the third plenary session for the Linggadjati Agreement, becoming a signatory on 25 March 1947; the Dutch considered him undiplomatic and prone to showing his emotions. He also worked to establish a national banking network, the BTC, as well as several trade organisations. With Amir Sjarifuddin and Setijadji, Gani was a formateur for the new cabinet, which received its mandate on 3 July. He stayed on as Minister of Welfare while also serving as a deputy prime minister under Sjarifuddin. Gani was the first cabinet member arrested during Operation Product, a Dutch assault on Indonesian-held territory in mid-July, but was later released. He also attended a trade conference in Havana, Cuba. In Sjarifuddin's second cabinet, Gani continued to serve as a deputy prime minister and minister of welfare until the cabinet collapsed on 29 January 1948 owing to dissatisfaction with the Renville Agreement.
Post revolution
After the revolution ended in 1949, Gani became the Military Governor of South Sumatra. In 1954, while still involved in politics as minister of transportation in the First Ali Sastroamidjojo Cabinet, he became the rector of Sriwijaya University in Palembang; he remained active in the province until his death on 23 December 1968. He was buried in Siguntang Heroes' Cemetery in Palembang. Gani was survived by his wife, Masturah; the couple had no children.