The five injured included two security guards, two faculty members and an overseas student, the Tongji University, where Beckham was scheduled to participate in a training session with the university's soccer team, said.
The 38-year-old soccer star, who is visiting Shanghai in his role as ambassador to the Chinese Super League, called of the training session, and expressed hope that the injured would recover soon.
"Nearly 1,000 people waited for Beckham and students broke the door of the gymnasium and got past a wall of security guards and policemen, causing the stampede," Shanghai Daily reported.
Police failed to control the crowd.
More From This Section
The injured have been rushed to a hospital. Their injuries were not said to be serious.
Official CCTV, however, said a number of people were injured and showed footage of badly injured men and women trying to escape from the crowd.
Beckham apologised for the event's cancellation in a posting on his new account on Sina Weibo, China's equivalent to Twitter.
"I had an incredible response from everyone at Shanghai Tongji University today. Sorry I couldn't get out on the pitch to see the teams. It was impossible to get through the massive crowds," he said.
Beckham began his new role in March, before announcing his retirement last month after winning the French league title with Paris Saint-Germain.