i always hear how the germans during ww2 was ahead of their time when it comes to their machine guns, why was the germans more advanced when it comes to machine guns?
The difference between the MG-42 and its predecessor the MG-34 compared to its contemporise was mostly a matter of design philosophy.
Most countries at this time had the philosophy that the best way to go about having machine guns would be to have a light machine gun and a medium machine gun as distinct categories of weapon which had slightly different jobs, be attached to units at different levels and have different characteristics.
A light machine gun was generally as the name suggests fairly light notably with components like the barrel that made them easier to carry around. They were generally magazine fed to help keep that weight down. Many of the more successful examples also had quick change barrels designed to help increase the sustained fire ability in the field without increasing the weight of the weapon, so that if one barrel was becoming too hot it could be quickly swapped over. They were generally deployed at the section/squad level. The aim here is to have a gun light enough the machine gunner can keep up with the riflemen in the section and be able to lay down a bit more fire in order to supress or destroy a target, generally you'd firing it from a prone position or resting on an object but it'd be light enough you could run up to take a position while the section was on the offence and light enough to be fired from the hip if you had to get off a few shots in a hurry. A great example would be the bren.
A medium machine gun was generally belt fed and had a heavier barrel, sometimes with big water coolers on them and often a bit of a faster rate of fire. This of course makes it harder to carry around but allows for a much greater ability for sustained fire. Generally they would put on larger tripod designs when used by infantry that gave it greater stability than a bipod allowing for greater accuracy at the expense of being heavier and often being carried by a second person rather than staying attached to the machine gun which affects set up and get up times.
Due to the fact a medium machine gun was too heavy to keep up with riflemen they'd be more often attached to small special weapons units in smaller numbers at a higher level. Sometimes its a section or squad at a company level, sometimes its a platoon at a battalion level sometimes its a battalion at a division level though that battalion might have its components detached to other units. These are really ideally used either in a defensive role or in a vehicle. due to their weight unless circumstances permit one to be more easily brought to bare against the enemy while other units attack. A prime example of this would be the Vickers or the M1919 browning .30cal.
The Germans however weren't necessarily operating with vastly technologically different level with the MG-34 and 42 though it was a good design with a fairly reliable fed and trigger mechanism. But they tried something a little bit different in that their design. They were trying to go for a middle ground between a light machine gun and medium machine gun that could be used in as many different roles as possible and be able to do as many different jobs as possible rather than these two slightly more specialised roles. And so the MG-34 and 42 were designed as General Purpose Machine Guns.
The two of them had a belt fed design similar to medium machine guns but had a barrel design more akin to light machine guns in that it was relatively light and design to be able to be changed as quickly as possible. This mean in terms of physical weight it was heavier than many light machine guns like the bren but still light enough to be carried by one person relatively easily. The belt fed design gave the advantage that the gun could have a far greater capacity than a magazine fed one which meant it could for for longer faster before it needed to reload, though the reload was slightly slower and this was a factor in making it a bit heavier than a magazine fed design. All this meant it was suitable for both fighting as part of squads, you could put it on a heavy tripod and with with the belt fed nature it could do the job of a medium machine gun nearly as well, though it'd have to stop to make barrel changes and the like more often than a heavier barrelled and/or water cooled design and similarly it was suitable for use equipped in any position on a vehicle.
While there were some advantages to have more specialised guns post war a lot of countries and gun manufactures did decide that the middle group represented by a GPMG offered the best balance of advantages and disadvantages leading to the use if the MG3, basically an MG42 rechambered for nato 7.62 used in Germany and designs that took some inspiration from the MG-42 like the FN MAG and the M60 which certain elements both in the general design philosophy and more specific elements of the trigger and fed mechanism borrowed.
EDIT: I should also mention that the Americans also did something a little bit different during the war to either the standard light and medium model or the german General purpose model in that rather than a true light machine gun they made the B.A.R as an automatic rifle. While the american manufacturing capacity allowed them to just provide more BARs per squad than most countries could produce light machine guns the gun had additional down sides in comparison to either a light machine gun or a general purpose machine gun. Lacking a quick change barrel mechanism leading to frequent failures of the weapon due to over heating and a smaller magazine capacity reduced the ability to use the weapon for any sustained suppression.