The Panzer IV was the brainchild of the German general and innovative armored warfare theorist Heinz Guderian. In concept, it was intended to be a support tank for use against enemy anti-tank guns and fortifications. Ideally, each tank battalion in a panzer division was to have three medium companies of Panzer IIIs and one heavy company of Panzer IVs. On 11 January 1934, the German army wrote the specifications for a "medium tractor", and issued them to a number of defense companies. To support the Panzer III, which would be armed with a 37-millimetre (1.46 in) anti-tank gun, the new vehicle would have a short-barreled, howitzer-like 75-millimetre (2.95 in) as its main gun, and was allotted a weight limit of 24 tons (26.46 short tons). Development was carried out under the name Begleitwagen ("accompanying vehicle"), or BW, to disguise its actual purpose, given that Germany was still theoretically bound by the Treaty of Versailles ban on tanks. MAN, Krupp, and Rheinmetall-Borsig each developed prototypes, with Krupp's being selected for further development.
The D variant, of which 248 vehicles were produced, reintroduced the hull machine gun and changed the turret's internal gun mantlet to a 35 mm (1.38 in) thick external mantlet. Again, protection was upgraded, this time by increasing side armor to 20 mm (0.79 in). As the German invasion of Poland in September 1939 came to an end, it was decided to scale up production of the Panzer IV, which was adopted for general use on 27 September 1939 as the Sonderkraftfahrzeug 161 (Sd.Kfz. 161).
More on Wiki (HERE)