Hosts Britain, taking part in their first Olympic soccer event since 1960, will kick off the bid for gold against Senegal at Manchester United's Old Trafford on July 26 after the draw was made at Wembley on Tuesday.
Senegal reached their first Olympics after beating Oman 2-0 in a playoff at the City of Coventry Stadium on Monday.
"It is such an honour to play against Britain in the opening match at Old Trafford," Augustin Senghor, the president of the Senegalese FA, said.
"I know we were the last to arrive in these finals after the playoff last night, but I hope that we will not be the first to leave. We will also field our strongest team and see if our players at Newcastle like Demba Ba and Papiss Cisse can be involved."
Britain will also meet Uruguay and United Arab Emirates in Group A.
Brazil, five-times World Cup winners but never Olympic champions, face Egypt, Belarus and New Zealand in Group C.
Spain, gold medallists in 1992 and the world and European champions, take on Japan, Honduras and Morocco in Group D while seeded Mexico meet South Korea, Gabon and Switzerland in Group B.
The first event of the Olympics takes place at Cardiff's Millennium Stadium on July 25, two days before the opening ceremony, when the British women's soccer team play New Zealand in Group E. Cameroon and Brazil are in the same section.
Hope Powell, Britain's women's coach said: "(I am) really excited by the prospect of playing the first event of the entire Olympic Games. It gives us a tremendous chance to showcase our sport and we cannot wait to play."
Women's world champions Japan face Sweden, South Africa and Canada in Group F while Olympic champions United States take on France, Colombia and North Korea in Group G.
The women's final is at Wembley on August 9 followed by the men's two days later.
Image: Team Great Britain head coaches Stuart Pearce and Hope Powell attend the official draw for the London 2012 Olympic Football Tournament at Wembley Stadium in London, on April 24, 2012.
Photograph: Jamie McDonald/Getty Images