Oxyrhynchus was the capital of the 19th nome, or province, of Upper Egypt and it first appears in heiroglyphic sources during the 25th Dynasty, or Nubian period, under its Pharaonic name Per-Medjed. However, its existence may date from the end of the New Kingdom, during the 20th Dynasty. At that time, it is possible that it was an encampment of Nubian mercenaries charged with guarding the border and protecting the caravan route that ran from Oxyrhynchus to the Bahariya oasis in the Libyan desert.
Per-Medjed was an important city by the 26th Dynasty, or Saite period (664-525 BC). A vital communications hub, it connected the caravan routes from the western oases to the river port on the Bahr Yussef, enabling navegation north all the way to the Mediterranean Sea in antiquity. The Oxyrhynchus nome had previously been consecrated to the god Seth. However, in the Saite period, the chief divinity of the city was represented by the oxyrhynchus fish.
After the conquest of Egypt by Alexander the Great in 332 BC, the city attracted a large number of Greek colonists, who gave it the name Oxyrhynchus. Soon, the city’s population exploded and it appears to have become the second largest city in Egypt. Oxyrhynchus benefitted from a privileged relationship with the new capital of Alexandria and maintained its size and importance during the Roman and Christian-Byzantine periods. Only after the Arab conquest in 640 AD did Oxyrhynchus begin to decline and by the Middle Ages it had reached an advanced state of decay.