The man was discovered at around 7pm on a train that had travelled from Italy into the Swiss canton of Ticino.
Passengers told newspaper 20 Minuti that they heard three loud bangs as the train passed through a tunnel between Como in Italy and Chiasso, on the Swiss border.
The train was stopped at Balerna train station when the man was discovered in flames in a gap between carriages after apparently being electrocuted by the train’s live cables.
He was declared dead at the scene.
In a statement, Ticino police said an investigation had been opened to determine the man’s identity and his reasons for being on the roof of the train.