Both Morocco goals were scored by Soufiane Rahimi, one just before half-time and then a penalty early in the second half as they looked to begin their 2024 gold-medal bid with a win.
Argentina pulled a goal back through Giuliano Simeone, the son of Atletico Madrid manager and former Argentina midfielder Diego Simeone.
But, after all the drama, it was Morocco who took the three points.
Argentina won the men’s Olympic football tournament in 2004 and 2008 and ex-Liverpool midfielder Javier Mascherano, who was a part of the winning squad for the second of those successes, is managing the team in 2024.
Mascherano’s side will now need to get positive results against Iraq on Saturday and Ukraine on Tuesday to have a chance of finishing in the top two in the group and advancing to the quarter-finals.