The class D XII tank locomotives were mainly built for the branch lines that ran from Munich into the mountains. At the time they were put into service, they were one of the most powerful tank locomotives and were also purchased by the Pfalzbahn and the Reichseisenbahnen Alsace-Lorraine.
The wheel arrangement 2-4-4T was chosen for the engines in order to be able to accommodate larger quantities of coal and water and to decouple the adhesive weight as far as possible from the filling level of the supplies. The leading axle and the first coupled axle were combined into a Krauss-Helmholtz bogie, while the driving axle had weakened wheel flanges and the rear bogie was mounted so that it could move 27 mm to the sides. As was to be expected, this design resulted in very smooth running.
Production for the Bavarian State Railways began in 1897 and included a total of 96 units, two of which were handed over to the Pfalzbahn in 1916. Between 1900 and 1903, 31 engines designated as P 2II had already been procured there, which were almost identical in construction to the D XII. In Alsace-Lorraine, a total of 37 units were procured between 1903 and 1912, which were initially designated as the T 5 and later as the T 7. If necessary, the latter were also used to transport express trains over short distances between their own network and the Palatinate network.
As successor, superheated Pt 2/5 H from 1906 was considered. However, the trial use showed that this brought hardly any advantages compared to the D XII, which was attributed to the low adhesive weight. So it remained a one-off and nine more examples of the previous design were made in the following year, which were now designated Pt 2/5 N.
Except for the two locomotives that were sold, all remaining 94 D XII were taken over by the Reichsbahn in 1925 and classified as class 730-1. They were given the numbers 73 031 to 73 124, since the Palatinate locomotives had already been given the numbers 001 to 028. The nine newest units were given numbers 131 to 139. Most units were retired by 1941, but the last ones only did so in the years after the war.