Muzahim was the son of Khaqan 'Urtuj and the brother of al-Fath ibn Khaqan, who were influential figures during the caliphates of al-Mu'tasim and al-Mutawakkil, respectively. He first appears in 862, during the reign of al-Muntasir, when he was appointed as a commander of Wasif'scampaign against the Byzantines. Under al-Muntasir's successor al-Musta'in, he led a Turkish army to quell a tribal uprising in Jordan after the local authorities proved incapable of defeating it themselves. Following the outbreak of civil war in 865 between the rival caliphs al-Musta'in and al-Mu'tazz, Muzahim initially sided with the former and made his way from Raqqa to Baghdad, where he was received with honor. Over the next several months he participated in the defense of Baghdad and was at one point wounded when he was struck by an arrow. In the summer of 865, with the civil war still ongoing, al-Musta'in dispatched Muzahim to secure al-Kufah, which had fallen to an 'Alid rebel. Muzahim defeated the rebels and forced the 'Alid to flee; he also ordered his troops to set fire to al-Kufah after encountering resistance within the city. After reporting news of his conquest, Muzahim received a letter from al-Mu'tazz, urging him to defect from al-Musta'in's side. After discussing the proposal, Muzahim and a number of his soldiers agreed to switch allegiances, and made their way to Samarra. After the end of the civil war in 866, which resulted in al-Mu'tazz becoming sole caliph, Muzahim was sent to Malatyah in the Byzantine frontier, and he reportedly went on campaign against the Byzantines.
In August 866, Muzahim arrived in Egypt with an army to reinforce the province's governor Yazid ibn Abdallah al-Hulwani, who had been having difficulty dealing with a number of revolts, including that of Jabir ibn al-Walid. Following Muzahim's arrival, Yazid and his lieutenants were subsequently able to make progress against the rebels, but they were unable to defeat them completely, and in 867 al-Mu'tazz dismissed Yazid as governor and appointed Muzahim instead. Following the receipt of his appointment, Muzahim continued with the effort to pacify the province. After putting down an uprising in the Hawf of Lower Egypt, Muzahim and his chief of security Azjur al-Turki shifted their focus to defeating Jabir. The next several months were spent on campaign against the rebel, and the latter finally sued for peace in August 867; Muzahim, however, imprisoned him in al-Fustat, and in the following year Jabir was sent to Iraq. According to the Egyptian historian al-Kindi, during Muzahim's administration his lieutenant Azjur mandated a number of ritual practices that were previously foreign to Egypt. Women were banned from the baths and cemeteries, while actors and mourners were imprisoned and lamentations at funerals were outlawed. The call to prayer was only to be made from the rear of the mosque; worshippers at the mosque were to be set up in orderly rows and were not allowed to bring cushions. The recitation of the basmala in the mosque during prayers was forbidden, and during the month of Ramadan only five prayers were allowed, instead of the usual Egyptian custom of six. Muzahim died in 868 after contracting an illness. Following his death, his son and designated successor Ahmad took over the governorship of Egypt.