David Anderson Hendrie was educated at the Inverness Royal Academy and in June 1879 joined the Highland Railway Locomotive Works, Inverness, as an engineering pupil. His first two years of training were spent in the drawing office. After completing his apprenticeship in the workshop the company appointed him as draughtsman. In 1889 he left Highland Railway to become leading draughtsman at the locomotive builders Sharp, Stewart & Co. of Glasgow. Two years later he was employed in the same position by another well-known Glasgow locomotive builder, Dubs & Co. During his time with these two firms he learned a great deal about locomotive design for the 1435 mm gauge. In 1893 he returned to the Highland Railway as assistant locomotive superintendent, succeeding G.W. Reid, one of his former tutors, who had been appointed to the Natal Government Railways. In October 1902 Hendrie was appointed to succeed Reid (again), this time as Chief Locomotive Superintendent of the Natal Government Railways in Durban. He assumed duty in January 1903. In July 1910, following the formation of the Union of South Africa, he became Chief Mechanical Engineer of the South African Railways, a post he held to his retirement in 1921.
During 1904-1905, with Charles J. Gray* and W.J. Quince, he was a member of the Natal Coal Testing Committee. However, his contributions to South African engingeering related to the design of 1065 mm rolling stock and the development of motive power. His spell with Dubs & Co. proved to be quite useful, as the Natal Government Railways was using modified Dubs locomotives when he joined them. In May 1904 his first engine design, designated the Dubs B, was introduced. Though similar in appearance to the Dubs A, it had greater power. However, the first significant development in locomotive design for which he was responsible was the 4-8-0 tender type engine, the Hendrie B, introduced in October 1904. With a tractive effort of some 140 kN, a wide fire box and the new Walschaert valve gear it was very successful in hauling long distances with few fuel and water stops, and introduced a new era of motive power. A few months later the Hendrie A, a 4-6-2 tender engine, was introduced to pull passenger trains between Estcourt and the Transvaal border. In 1909 the Hendrie D was introduced, a heavy goods engine to haul coal. Around that time Hendrie visited the United States to study American locomotive designs. A reversing gear that he had designed in 1907 was fitted to a new batch of Hendrie B engines that came into service in 1909 and 1910. It was so successful that it became a standard fitting on all his locomotives. He also designed the early Natal corridor coaches and dining saloons. In 1910 two 4-6-2 tender engines similar to the Hendrie D were built at the Durban workshops; they became known as the Hendrie C and were the first modern locomotives to be entirely designed and built in South Africa. The next year saw the introduction of an improved version of the Hendrie D, the South African Railways Class 3B, the first of his locomotives to be equiped with a Schmidt type superheater and piston valves. In 1915 followed the most advanced of his designs based on the American Mallet engine, five massive, British built engines, some 24 m long, weighing 179 tons, and developing a tractive effort of some 239 kN at 50% operating pressure. This class MH Mallet was thought to be the heaviest engine to run on 1065 mm gauge anywhere in the world at the time.
Hendrie designed practically all the rolling stock for the South African Railways in his time. Although these were mainly steam engines, just before his retirement he designed South Africa's first electric unit, to transport Natal coal. His close friend, the statesman General J.C. Smuts*, described him as the greatest railway engineer in the southern hemisphere.