Why did not the Mughals leave India like the British, they too invaded India?
Every foreign ruler that India had seen was very smart and wise to know the riches that India had to offer. India is very strategically placed, you could control the whole of South Asia if you had control over India and have a powerful navy( evident from chola dynasty and the British) thus you could impose taxation on important trade routes and get very rich.
Now coming to the mughals, the earlier Mughal kings like Babur and humayun did not invest their time in strengthening their rule in India. Babur only won India but actually ruled from Kabul. Humayun was only busy making merry during his reign and got his ass kicked by Sher shah suri. It was Akbar who tried to consolidate the mughals empire by conquering or making allies with other kingdoms( The Rajputs). He was the only Mughal king who was sane and had some brains. If it were not for him, the mughals would have been wiped out. It was Akber who created a connect with India and made it his home and so did his successors( yet they oppressed Indians).
The British on the other hand didn't come to India as conquers or with the intention of setting up colonies( the Dutch and French and already setup their colonies btw) but as traders yet, they too knew the value that India held. They used their diplomatic ties with local kingdoms to influence their trade and slowly started gaining power.
The British never thought of India as their home on the other hands mughals thought of it as their home. Both were oppressive in nature, the mughals treated India as their self earned property thus littered it and the British treated India as a rented house thus they didn't care to if it gets littered.
There is a difference between Invasion of Mughals and Invasion of British.
- Babur the first ruler of Mughal Dynasty defeated Ibrahim Lodi and became the ruler of India and his successors came to be known as Mughals, whereas British East India company came as traders took advantage of the weak rule, found out the weak points and established themselves on throne later after the revolt of 1857. The East India company's rule ended and British rule started.
- Mughals didn't treat Indians as Slaves or discriminate between Hindus or Muslims. Many Hindus worked in the court of Mughal rulers like Akbar and even Aurangzeb. British on the other hand called Indians as ‘uncivilized' .
- Mughal rule was a monarchy while British rule was a Colonial rule. Before Mughal foreign Invaders like Kushans too Invaded India and settled there. Monarchy existed before Mughals but Colonial rule (in India) didn't exist before British.
So British rule was unjust and there was a need for Independence while Mughal rule was a Monarchy and after Mughals Marathas made an empire on the ashes of Mughal Empire.
Mughal ruler saw themselves as Indian while British saw Indians as uncivilised race and Inferior to their race.
So there was no need of Mughals to leave India but there was a need of British to leave India.