These two guns are probably the biggest known guns in US and Middle East. The M4 was made in the US and has been in use in the military since 1997. It is effective because its is very accurate at any range, on can put a scope on it and hit targets from distances, or if your in a building with insurgents, it is also very effective. The AK47 is "one of the most encountered guns on the planet." This guns is so wildly known. The first time it was used was in 1949 by Russian Troops. It is popular because it is low in price, for its quality.
To compare them, the Ak47 weighs 9.5 pounds with no mag. The M4 though weighs 7.5 pounds WITH a magazine and a sling. The M4's caliber is 5.56mm while the AK47 is 7.62mm. Although it is a bigger bullet, that is not always good. You can have bigger push back, making your only option for long range targets, semi-automatic. The M4's max range is around 600m, which is nearly 1,969 feet. The AK47's max range is only around 300m.
The M4 has a good agile body. The stock is retractable and extend-able. The top of the gun has a rail on it, to put scopes and sights and stuff. You can also put a grip on the front of the gun to have even better accuracy. The AK47 has a changeable sight, but besides that, It has none of the attachments that the M4 has. All of this makes me believe that the M4 is the better if you were in a gunfight. You can shoot very far range with it and still be more accurate than the AK47. It is very personal for the user (changeable stock, attachment rails). You may put grips on it, and it also weighs less than the AK47. From all this, it would be hard for me to believe that the M4 is not a better weapon than the AK47.
M4 vs AK article
Video for M4 and AK47 firing