I don't have the book on hand to give an exact citation (was a library book I returned two weeks ago but it is a biography of General Louis-Antoine Desaix called Le Sultan Juste, talks a lot about the Egyptian expedition) but the general idea was to create a base/colony in Egypt and from there to launch another expedition via the Red Sea and the Indian Ocean to land troops that would meet up with the leader of one of the few independent Indian states of the time, the Tipu Sultan of Mysore. They wouldn't have marched overland, but sailed in another armada to India, even before the Suez canal, the Red Sea-Mediterranean junction was very important to British interests as it was far quicker than sailing around Africa. Even if there wasnt an European colony in Egypt, there was plenty of activity of european merchants and the like in the area.
This state south of Goa, Mysore, was at war with the British at the same time as Napoleon's forces were in Egypt, the idea being if they could link up, they could push the British out of India. Of course this is a grand idea but even then it was still very vague and, as you put it, "ridiculous". The french were in contact with the Tipu Sultan but it was only a couple messages and there's no evidence he ever sent a letter to Napoleon himself. Turned out to be a moot point because Arthur Wellesley's forces in India assaulted Seringapatam in 1801 I believe. The sultan was killed in the fighting and the state passed under British control.
Ultimately the Egyptian expedition had grand ideas that werent very practical and hinged on a lot of ifs (the ottomans buying the story they were "giving egypt back to them" from the Mamelukes, the egyptians buying they were liberating them, establishing a colony with only ~30,000 troops hundreds of miles from home with no contact after the Battle of the Nile evaporated the french mediterranean fleet, being able from Egypt to launch a second expedition to India). Why did it happen then? Mostly because the Directory, the republican govt of the time, was so weak they needed military victories to justify their existence and Napoleon had become "too popular" after his masterful Italian campaign of 1796-7. It was mostly to get him out of the country, they were scared of him as a popular general launching a coup. Which he ended up doing anyway ironically enough.
Ultimately the dream of invading India died de facto after Nelson's victory at Aboukir, but the Egyptian expedition as a whole really ended after Napoleon failed to capture Acre in Palestine