Kalashnikov invented a rifle to kill lots of German soldiers in the most efficient manner possible. It was designed to be used by motor rifles, armored infantry in the assault. It is short, easy to maneuver inside an APC, It fires fully automatic first, as the need is for suppressive fire first, accuracy second. It was designed to be simple, robust, reliable and easy to maintain by poorly educated conscript soldiers. It has functioned exactly as designed in the harshest of conditions. Heat, cold, mud, sand, water, careless maintenance, grungy ammo, crappy magazines, the "Klashin" can take it.
There are dozens of variants, the most popular being the AKM, with a pressed steel receiver to both lighten the gun and make it cheaper and faster to produce.