Kampilya was the Capital of the Panchala Kingdom ruled by Drupada during Mahabharata period. It is mentioned in Mahabharata that when Pandavas were in exile and staying at place called Ekachakra (Etawah, Uttar Pradesh), they came to know that Drupada, King of Panchala, had announced the Swayamvara of his daughter Draupadi. Then they came to Kampilya (Kampil, Uttar Pradesh), the capital of Drupada.
The historian Thakur Deshraj has mentioned that the people of Kampilya were later known as Koil. The Koīl people came from Kampilya and founded the city known as Kampilgarh, situated south east of Ganges. The town of Kampilgarh later became popular as Koil which is now Aligarh.
Shri Nagendranath Basu has mentioned in 'Bangla vishva kosha' that Jats seized Ramgarh in 1757 AD and named it Koil. This was later taken by the Maratha who appointed a Frenchman named Piran as administrator of this place. Koil is also mentioned in an old folk-song 'Rag dhola' which tells about Fool Singh Punjabi Jat as its ruler. This place was also ruled by Maharaja Suraj Mal of Bharatpur for some time.