Uruguay and Belarus also won as the tournament got under way with eight matches the day before Friday's opening ceremony.
Japan pulled off the surprising win after outplaying gold-medal favourite Spain, which went a man down in the first half and couldn't fight back.
Brazil got three first-half goals but nearly squandered the lead in the second, escaping with the victory to begin its quest for its first gold in Olympic football.
Britain's debut was spoiled by a late goal conceded in the draw with Senegal.
Japan got the winner in Glasgow when forward Yuki Otsu broke away from his marker during a corner in the 34th minute and the ball landed right at his feet for a simple tap-in past Manchester United goalkeeper David De Gea.
Spain was reduced to 10 men just a few minutes after the goal when centre back Inigo Martinez was sent off for a foul while trying to stop a Japanese player from scoring.
"It was an important win for us," Japan captain Maya Yoshida said. "Spain are a very strong team in the group and we played well against them. We worked really hard and we will enjoy our victory. We can get a lot of confidence from this."
The loss comes as a blow for Spain's under-23 team, which wants to win Olympic gold to add to the World Cup and European Championship titles held by the country's full national team.
The Olympic side has two more matches to turn it around, against Group D opponents Honduras and Morocco, which drew 2-2 in Newcastle.
"Our aim is to win both of them. We have to," said Spain forward Juan Mata, who plays for Chelsea and is one of the three overage players. "We need to improve some things and we have to play better."
In Cardiff, Brazil got goals from Manchester United's Rafael in the 16th, Leandro Damiao in the 26th and Neymar in the 30th to earn a comfortable halftime lead before Egypt made it interesting with goals by captain Mohamed Aboutrika in the 52nd and substitute Mohamed Salah in the 76th.
Brazil leads Group C along with Belarus, which beat New Zealand 1-0 in Coventry with a first-half goal by Dmitry Baga.
At a nearly packed Old Trafford Stadium, Britain took the lead in the 19th after Senegal failed to clear a free kick into the box from captain Ryan Giggs. Fellow Welshman Craig Bellamy pounced on the loose ball, driving a shot into the ground that bounced to the left of keeper Ousmane Mane.
But Senegalese striker Moussa Konate ran on to a through ball that exposed Britain's defence fragility before chipping Butland from close range.
A frantic final few minutes saw Britain substitute Marvin Sordell hit the bar from close range. Konate could have scored a second, but his shot went wide.
"The fact that we got our noses in front and didn't go on to nail the game was a frustration," said Britain coach Stuart Pearce. "We've got another tough game Sunday, the group looks like it might be wide open."
Britain is playing in its first Olympic competition since 1960.
Earlier in Manchester, medal contender Uruguay got a goal from substitute Nicolas Lodeiro in the second half to defeat the United Arab Emirates 2-1.
In Group B in Newcastle, Gabon rallied for a 1-1 draw against Switzerland and Mexico escaped with a 0-0 draw with South Korea, which played better but failed to capitalize on the several scoring opportunities it created at St. James Park.
The football tournament started early because of its long match schedule. The women's competition got under way on Wednesday, two days before Friday's opening ceremonies.
Follow Tales Azzoni at http://twitter.com/tazzoni