The former Friends star talked about the primary school incident on a Wednesday-night television appearance.
Mr Perry was born in the US state of Massachusetts but raised in Ottawa, Canada and attended the same school as Mr Trudeau.
He said a friend recently reminded him of the long-ago altercation.
The actor and comedian said he was a couple of years ahead of Mr Trudeau in school.
"I have a story about him that I'm not proud of," he recounted on the Jimmy Kimmel Live talk show.
"I think he was excelling in a sport that we weren't. So it was pure jealousy."
The current prime minister lived in Ottawa and attended school there as a youth while his father, Pierre Elliott Trudeau, served as prime minister.
Perry, who came to fame playing the awkward, sarcastic and funny character Chandler Bing on Friends, also lived in the Canadian capital with his mother, who was a journalist and served as a former press secretary to the elder Trudeau.
"I'm not bragging about this, it was terrible, I was a stupid kid," he told Mr Kimmel.
But he jokingly said the incident might have helped spur Mr Trudeau's future ambition.
"I think it was rather instrumental in him becoming, you know, going to such great heights and becoming the prime minister. I think he said 'I'm going to rise above this.'"
He said he still feels bad about the incident.
"I feel shame, I don't want to think about it," he told Mr Kimmel.
Actor Matthew Perry is claiming that he once "beat up" Canadian Prime Minister Justin Trudeau.