Why do bullets in a magazine go up instead of down? I've been curious about this, and it might not belong here, but I'll ask anyways.
For most modern weaponry that I've seen or used, it appears that the magazine is always placed below the barrel of it.  Instead of the magazine going on top of the gun, per say, the magazine is placed below the gun barrel itself. For example, the default assault rifle used in the US military is the M16:

As you can tell, the magazine is below the barrel of the gun, and bullets are loaded in one at a time into the chamber.
What I'm curious is to why bullets in magazines are placed this way. I've had friends who say that physics plays a role, in that if you put the magazine on the top, gravity could force an extra bullet into the chamber and cause a misfire.  But isn't putting the magazine in the top more efficient? Letting gravity do the work?
Some guns like the Sten, used in WWII, have a magazine that go in via a slot in one side of the gun. Most sidearms have their magazines located in the grip of the gun.

Why was this implemented? Is there some aspect of physics that allows an optimal entry point for bullets to go in the chamber?
Edit:
Based on a chat in Arqade's room (The Bridge), it seems there are very few guns that actually have magazines inserted from the top. The only few guns we could find were the Bren (below) and the M1 Garand, although that uses an en-bloc clip that feeds up.

 A: A magazine on the top would block the view of the person sighting along the gun.
A magazine out of the side would get in the way, especially in buildings, vehicles etc. It also means you might need to make a left and right handed version
I don't think there is any physics, rather than ergonomics reasons
A: In the bullet magazine of a modern gun the magazine consist a spring or a compressed air chamber at the bottom of the magazine which pushes the bullet up ward's when a bullet is fired and there is a empty space at the top of magazine that's how the bullet goes upward in the magazine. Now the answer to you second question, that the decision to where to place the magazine according to me is totally based on the internal working's of the gun, how much recoil does it produces and in which type of condition it is going to be used. A magazine on the side of the gun was given as shown the picture you posted so that user can get a better grip because the earlier gun's where not so stable as compare to modern gun's because modern gun's have internal mechanism to reduce the recoil produced by the firing of the gun. In that type of gun user holded the magazine also while firing the gun.
A: There is obviously a force acting against gravity here, but it is usually supplied by some sort of compressed spring, or perhaps by the energy of the previous round. Yes, you would have to expend less work if you worked with gravity rather than against it, but that amount is pretty trivial compared with the energy in a single bullet anyway, or even the energy you can store in a spring.
Now properly designed, a gravity-assisted loading mechanism is no more prone to misfiring than any other mechanism. (Though it may reload rather slowly, come to think of it.) But if nobody is making such designs, then no one is perfecting them either.
Also, by relying on something other than gravity, you allow the gun to be fired at an angle (if you're trying to look cool in a movie) or even upside-down (also I suppose if you're trying to look cool in a movie).
In the end, it's more about ergonomics than physics.
A: Most of the modern strip magazines have an internal spring in it, which can be exampled with this drawing:

For spring-fed magazine it doesn’t really matter at which angle you stick it in. Gravity-fed magazines are a different beast, and by nature have to be on the top. I do not know of many, but a famous example would be a Gatling gun (via Forgotten Weapons):


Gatling mags of this period vary in capacity and curvature, depending on the cartridge they were designed for. These magazines also included weighted followers to help push rounds into the gun, although these were not spring loaded. Feed boxes for the 1865 model had been made with followers, but still having removable lids instead of spring catches to hold in ammunition. Early guns held the magazines at a 45 degree angle off the left side of the gun.

Basically, at this point the theoretical physics of this topic ends, and applied physics in form of engineering begins. Considerations in making the design decisions are many. Sometimes it is pure ergonomics. The above slanted Gatling magazine was such to keep sights open. However, other matters interfered (ibid.):

The angled magazine was located so as to allow use of the sights, which were located centrally on the gun. In 1874 this arrangement was changed, though, and the sights were moved to the right side to allow a vertical magazine on the centerline of the gun. This reduced friction in the mag, and improved feeding.

In other instances compromises had to be made. For instance, general purpose Italian WW II MG, Breda modello 30 had to be fired from clips as infantry support weapon, and belt-fed when in emplaced position, hence the ammunition is side-fed:

German FG42, however, is different, because the configuration of the firing mechanism was such that in order to keep sights clear, or use optics, there were nowhere else to stick the mag, but to the side:

In general, multiple factors affected the design, such as availability of technology and machinery to produce parts (e. g., stamped v. milled parts), availability of stockpiled earlier parts that needed to be used up, considerations of weight, compactness, ease of use, mode of operation, and so forth.
I believe, nowadays most infantry weapons are bottom loaded for the sake of compactness and readiness (when you carry a weapon, whether in hand, or on the shoulder, or on the back, there is nothing sticking out sideways, and it is ready to go any time). In different situation, such as plane-muonted defensive MG, different traits are preferred: weapon has to have high-capacity magazine (hence no clips), with wide range of motion and ease of one-man operation (hence belts were not always welcome as they can be fiddly), therefore the flat “pancake” drum was often used.
