Hryhor Orlyk was born on November 5, 1702, in Baturyn, the capital of Cossack Hetmanate in the family of Cossacks' "General scribe" Pylyp Orlyk. The family was very well connected with the then hetman Ivan Mazepa, who became Hryhor's godfather. After Mazepa's defeat at Poltava in 1709 him and his allies, including the family of Pylyp Orlyk fled Ukraine for the Ottoman territory – Bendery, (present day Moldova), where Orlyk and his family together with other Ukrainian émigrés and the defeated Swedish king Charles XII had lived for five years. Upon Mazepa's death, Pylyp Orlyk was proclaimed the hetman of Ukraine in exile and by agreement between Tsardom of Russia and the Ottoman Empire in 1714 Charles XII and his allies were allowed safe passage to Sweden.