Muhammad Azam was born on 28 June 1653 in Burhanpur to Prince Muhi-ud-Din (later known as 'Aurangzeb' upon his accession) and his first wife and chief consort Dilras Banu Begum. His mother, who died four years after giving birth to him, was the daughter of Mirza Badi-uz-Zaman Safavi (titled Shah Nawaz Khan) and was a princess of the prominent Safavid dynasty of Iran (Persia). Therefore, Azam was not only a Timurid from his father's side, but also had in him the royal blood of the Safavid dynasty, a fact which Azam was extremely proud of and after the death of his younger brother, Prince Muhammad Akbar, the only son of Aurangzeb who could boast of being of the purest blood.
Azam's other half-brothers, Shah Alam (later Bahadur Shah I) and Muhammad Kam Bakhsh being the sons of inferior and Hindu wives of Aurangzeb. According to Niccolao Manucci, the courtiers were very impressed by Azam's royal Persian ancestry and the fact that he was the grandson of Shah Nawaz Khan Safavi.
As Azam grew up, he was distinguished for his wisdom, excellence, and chivalry. Proud of his royal Persian ancestry, he was also (like his mother) haughty and imperious. Aurangzeb used to be extremely delighted with his son's noble character and excellent manners, and thought of him as his comrade rather than his son. He often used to say, "between this pair of matchless friends, a separation is imminent." Azam's siblings included his older sisters, the princesses: Zeb-un-Nissa, Zinat-un-Nissa, Zubdat-un-Nissa and his younger brother, Prince Muhammad Akbar.
Azam was at first betrothed to be married to his cousin, Iran Dukht Rahmat Banu (titled Bibi Pari), the daughter of Shaista Khan, who was Aurangzeb's maternal uncle. However, the marriage did not take place due to Bibi Pari's sudden death in 1665 at Dacca. On 3 January 1669, Azam married his first cousin, Princess Jahanzeb Banu Begum, the daughter of his eldest uncle Dara Shikoh and his aunt Nadira Banu Begum.
Jahanzeb was his chief consort and his favourite wife, being greatly loved by him. She gave birth to their eldest son on 4 August 1670. He was named 'Bidar Bakht' by his grandfather. Aurangzeb, throughout his life, showed marks of exceptional love to Azam and Jahanzeb (who his favourite daughter-in-law) and to Prince Bidar Bakht, who was a gallant, discreet and ever successful general, on all three of whom he used to constantly lavish gifts. Bidar Bakht was also Aurangzeb's favourite grandson.
In a marriage of political alliance, Azam later married his third (and last) wife, Shahar Banu Begum (titled Padshah Bibi) in 1681. She was a princess of the Adil Shahi dynasty and was the daughter of Ali Adil Shah II, the ruler of Bijapur. Despite his two other marriages, Azam's love for Jahanzeb remained unchanged. For when she died in 1705, he was filled with great sorrow and despair which darkened the remainder of his life.
In the year 1685 Aurangzeb dispatched his son Muhammad Azam Shah with a force of nearly 50,000 men to capture Bijapur Fort and defeat Sikandar Adil Shah the ruler of Bijapur who refused to be a vassal. The Mughals led by Muhammad Azam Shah could not make any advancements upon Bijapur Fort mainly due to the superior usage of cannon batteries on both sides. Outraged by the stalemate Aurangzeb himself arrived on 4 September 1686 and commanded the Siege of Bijapur after eight days of fighting and the Mughals were victorious.
Prince Azam was appointed the governor (Subahdar) of Berar Subah, Malwa and Bengal from 1678–1701 upon the death of his predecessor, Azam Khan Koka. He successfully captured the Kamarupa region in February 1679. He founded the incomplete Lalbagh Fort in Dacca. During his administration, Mir Maula was appointed Diwan and Muluk Chand as Huzur-Navis for revenue collection. Prince Azam was recalled by Aurangzeb and left Dacca on 6 October 1679. Berar Subah and Malwa were annexed by the Marathas; Bengal went under administration of the Nawabs of Murshidabad.
He later became the governor of Gujarat from 1701 to 1706.
In third week of February 1707 in a bid to prevent a war of succession, Aurangzeb separated Azam and his younger step-brother, Kam Baksh, whom Azam particularly loathed. He sent Azam to Malwa and Kam Baksh to Bijapur. A few days before his death he wrote farewell letters to Azam. The next morning, Azam who had tarried outside Ahmednagar instead of proceeding to Malwa, arrived at the imperial camp and conveyed his father's body for burial at his tomb at Daulatabad. Azam Shah proclaimed himself Emperor and seized the throne. In the political struggles following the disputed succession, he and his son Prince Bidar Bakht were defeated and killed on 8 June 1707 at the Battle of Jajau by his step-brother, Prince Muhammad Mu'azzam, who succeeded their father to the Mughal throne.
His grave along with that of his wife, lies in the dargah complex of Sufi saint, Sheikh Zainuddin, at Khuldabad near Aurangabad, which also houses the tomb of Aurangzeb to the west.
Padshah-i-Mumalik Abu'l Faaiz Qutb-ud-Din Muhammad Azam Shah-i-Ali Jah Ghazi