The GWR Class 2-8-0 No. 2818 was built at Swindon Works in 1905 and is to go on display at the town's Museum of the Great Western Railway (GWR) - STEAM.
The heavy goods steam train was withdrawn from service in October 1963.
It has been housed at the National Railway Museum in Shildon, County Durham, since it was decommissioned.
The locomotive was introduced by GWR chief mechanical engineer George Jackson Churchward in 1903 and 167 were built in total.
The National Railway Museum's Andrew McLean said: "2818 is a very important locomotive in documenting the story of the development of the railways in the South West and south Wales and it is fitting that we can return this long-serving engine to its Swindon birthplace almost 112 years after it first rolled off the production line."
Garry Perkins of Swindon Borough Council added: "We can't wait to have No. 2818 on public display and look forward to welcoming many new visitors who will love to see this splendid heavy freight locomotive."
Details of the locomotive's transfer are yet to be announced, but No. 2818 is expected to be housed inside STEAM before the end of the year.
An historic locomotive considered to be "very important" in the development of the railways is returning to the town in which it was built.