Born at Shemakha in what is modern day Azerbaijan as the son of a vendor, Afandiyev participated in the revolutionary movement of Azerbaijan—at that time a region of the Russian Empire—beginning in 1902. In 1904, Afandiyev was one of the organizers of Hummet party and took an active part in the 1905 Revolution.