The Dutch giants, who have reached the group stage of Europe's premier competition for the first time since 2005-2006, will play in the tough Group G that also includes French side Auxerre.
Ajax coach Martin Jol, aware that reaching the knockout stage will be difficult, said he eyes a 'realistic' place in the Europa League, the continent's secondary competition.
"We must be realistic. A third-place finish in the group will be enough," Jol said after the draw was made on Thursday.
"Assuming that Real and Milan will occupy the first two places, we will have to battle it out with Auxerre for the third.
"That will be difficult because they finished second in the French league, which is stronger than the Dutch league."
Egyptian striker Mido will experience Champions League football for the third time in his career, having played in the group phase of the elite competition with French club Marseille and Italian side AS Roma.
He scored against Spanish giants Real in a 2003 Champions League game whilst at Marseille.
The much-traveled frontman will vie with Uruguay World Cup striker Luis Suarez and Moroccan Mounir El Hamdaoui for a regular place in Ajax's starting line up.
Mido joined Ajax, the club where he made his name in the early 2000s, after terminating his contract with English second-division side Middlesbrough.
Champions League holders Inter Milan were grouped with English side Tottenham Hotspur, Germany's Werder Bremen and Holland's Twente Enschede in the draw.
Barcelona, European champions in 2009, will face Panathinaikos, FC Copenhagen and Russians Rubin Kazan
The draw:
Group A: Inter Milan, Werder Bremen, Tottenham, FC Twente
Group B: Lyon, Benfica, Schalke, Hapoel Tel-Aviv
Group C: Manchester United, Valencia, Rangers, Bursaspor
Group D: Barcelona, Panathinaikos, FC Copenhagen, Rubin Kazan
Group E: Bayern Munich, AS Roma, Basel, CFR Cluj
Group F: Chelsea, Marseille, Spartak Moscow, Zilina
Group G: AC Milan, Real Madrid, Ajax, Auxerre
Group H: Arsenal, Shakhtar Donetsk, Braga, Partizan Belgrade