The incident occurred at the Heritage Loco Shed in Rewari on Saturday. No one was injured in the episode, said railway officials.
As the 52-year-old Akbar started moving on its own, scared loco pilot Bharatbhushan jumped off as he believed there was a malfunction.
The engine broke the main gate wall of the shed and rolled on for about 2 kilometres towards the main track of the Rewari-Rohtak-Hisar route, before getting derailed just four metres away from it.
"Akbar was brought out of the shed for a trial on Saturday afternoon, two hours before a scheduled inspection by the Executive Director and his team in the day," said a loco official.
But as Bharatbhushan switched on the ignition, the engine started moving on the tracks on its own.
But "it suddenly became uncontrollable and started running on the tracks at a notable speed. I got scared and jumped off the engine. It continued the run for about nearly five minutes, covering around 2 kilometers without me.
The engine was inducted in 1965 after being manufactured at the Chittaranjan locomotive factory in Bengal.
It has featured in Sunny Deol's "Gadar: Ek Prem Katha", Salman Khan's "Sultan", "Bhaag Milkha Bhaag", "Rang De Basanti", "Gandhi My Father", "Gangs of Wasseypur", "Qarib Qarib Singlle", Malayalam movie "Pranayam", Tamil movie "Vijay 60", "Netaji Subhas Chandra Bose: The Forgotten Hero" and some documentaries, an official told IANS, adding it earned the railways lakhs of rupees per hour during film shootings.
"A large sum of money is spent on its maintenance every year. Now repairs may require a lot more money," he added.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.