Garayev was born in Shamakhi, Azerbaijan. Having completed Shamakhi Realny School, he taught at a Russian school in Baku. He then entered the NovocherkasskPolytechnic Institute and was involved in student revolutionary activities. In 1917, he chaired the Shamakhi Workers and Soldiers Council. During 1918-1920, Garayev was leader of faction Hummet in Azerbaijan representing social-democrats. After occupation of Azerbaijan by the Red Army on April 27, 1920, he was member of the Interim Azerbaijan Revolutionary Committee, Baku Revolutionary Committee, People's Labor Commissar, People's Commissar for Military and Naval Affairs of Azerbaijan and briefly headed the Baku City Executive Committee.
Overthrowing ADR government
Garayev was the Bolshevik leader who facilitated arrival of the Red Army in Azerbaijan and overthrow of the government of Azerbaijan Democratic Republic. He was one of the people along with Bolshevik activist Chingiz Ildyrym, who passed on the ultimatum to the Azerbaijani Parliament to surrender and transfer all authority to Bolshevik forces. While lobbying for arrival of Bolshevik troops in Baku, Garayev convinced the ADR government that with establishment of Soviet regime in Azerbaijan, the Red Army will crash the Armenian rebels in Karabakh region of Azerbaijan. Bolshevik power in Azerbaijan SSR have managed to keep the Nagorno Karabakh and Nakchivan in the territory of Azerbaijan. Only Zangezur was transferred to Armenian SSR. According to a known rumour, after establishment of the Soviet republic in Azerbaijan, Garayev lobbied for arrest and execution of one of founders of Azerbaijan Democratic Republic and Chairman of Azerbaijani National Council, Mammed Amin Rasulzade but was cut off in the meeting with Stalin who declared that Rasulzade had saved his life twice and that he would go free. In response to Garayev's earlier chant in front of the members of Azerbaijani parliament that he would get everyone executed, Rasulzade had responded that the very Bolshevik government which Garayev defended would execute him in the future.
Activities in Soviet Azerbaijan
From 1921 through 1931, Garayev held various administrative positions in the Soviet government. He was editor is a number of magazines and journals such as Khalq Qazeti, Kommunist and others. He personally authored many Bolshevik propaganda articles in Azerbaijan such as Who needs mourning? targeting abolishment of religious practices in the republic. While People's Commissar of Justice, he convicted and imprisoned some of the Azerbaijani intellectuals. Garayev is infamous for his political intrigues. He would determine the individuals who had sympathies for Azerbaijani nationalism working in press and had them arrested. Nariman Narimanov have criticized Garayev's career with claiming that the source of his mistakes are his "young and hot-blooded personality." A Woman's Club in Baku was named after Aliheydar Garayev in the 1920s which was involved in movement for education and emancipation of women. After independence of Azerbaijan, the street named in honor of Aliheydar Garayev was changed to Ahmad Javad street.
Death
On recommendations from Lavrentiy Beria to Stalin, Aliheydar Garayev was arrested and charged with espionage and preparations for counter-revolutionary activities in the years preceding the Great Patriotic War. He was executed by firing squad on April 24, 1938, on Stalin's orders.
Awards
Garayev had been awarded with Order of the Red Banner of Labour for his contributions to Bolshevik movement during his terms in office.