Ganja is one of the oldest and most significant cities in Azerbaijan, with a history rooted in the early Middle Ages. The first mentions of the city appear in Arab sources, which date its foundation to the 9th century. According to one version, the city was founded by the Arab governor Muhammad ibn Khalid in 859 AD. The name "Ganja" is believed to derive from a Pahlavi word meaning "treasure" or "hoard," which is possibly linked to a legend about the discovery of immense riches here.
The rise of Ganja as a major centre was driven by several key factors. Firstly, its advantageous geographical location on the Great Silk Road turned the city into an important hub for international trade. Secondly, the fertile lands and its location at the foothills of the Lesser Caucasus range fostered the development of agriculture. Thirdly, Ganja repeatedly became a political centre, notably serving as the capital of the Shaddadid dynasty in the 10th-11th centuries and one of the residences of the rulers of the Eldiguzid state in the 12th-13th centuries.
During its golden age, particularly in the 11th–13th centuries, Ganja was known as a thriving city of artisans and merchants. High-quality silk, jewellery, ceramics, and weaponry were produced here. The city also became one of the most important cultural centres of the region. It was here that the great poet Nizami Ganjavi (12th century) lived and created his works, his legacy forever inscribing Ganja into the history of world literature. Science and education flourished, and madrasahs operated, attracting scholars and thinkers to the city.