I've heard that sounds tend to be dubbed in afterwards, rather than being recorded live. Everything from walking to opening and shutting doors. What is the reason for doing this?
The typical big budget movie has 50–150 people standing just outside but close to the shot:
Further away are tradesman who do
Someway into calling the roll, there will be a call for quiet—possibly including briefly ringing bells and/or flashing red lights coming on around the sound stage—at which time all hammering, drilling, pounding, sawing, etc., air compressors, and air conditioning are silenced.
The transition is profound—from total bedlam to near silence—but there are still dozens and dozens of people breathing, drinking, chewing, or moving—much more slowly than normal—and further away talking quietly (if they dare). All that activity adds up to background noise that even the most directional microphone can't help but capture.
Then there is the inevitable unavoidable sounds: actors (or the camera) on turntables for revolving shots: the turntable always makes some creaking and grinding noises. Or fake elevator doors have the wrong sound. Or the subfloor on a sound stage is always two layers of 3/4 inch plywood over a frame 4 feet above the floor. Even if the flooring is granite, an actor walking over that just doesn't sound right.
The general acoustics of a sound stage also aren't conducive. A conference room won't really have a ceiling: it is open or missing for lighting and perhaps so the boom folks can reach in to get a good microphone angle on an actor. The windows aren't really there—to avoid troublesome reflections, and so the acoustic ambiance of almost any onset room will sound slightly wrong.
For comedy, most directors and actors prefer capturing the sound live for its more spontaneous and natural effect. But for drama, it is easier and more compelling to ADR and/or foley in a soundproof room with only one or two people present to eliminate all the subliminal distractions.
Also, films which are dubbed into other languages need to have the set's apparent acoustic ambiance separate so that its sound can be layered with the dubbed audio.
The main reason is really cost, plus you can get far better results in a Foley stage.
Recording sounds live is very expensive and difficult to get each of the sounds independently so that they can be properly mixed later. Say that you want to record the sounds you describe live where there are footsteps and a door shutting. You would have to record two separate sounds for each to allow for later flexibility in mixing the sounds. Furthermore you have the entire crew (who would need to be very quiet) waiting around while the sound guys do their work. Alternatively, they= sound crew could come back after the main crew leave and record the sounds, but this require access to the location for a longer period of time (and again results increasing the cost).
Or consider the case of a restaurant scene where the main characters are engaged in a conversation. When shooting such scenes, all the background people pretend to be chatting and eating but they have to refrain from making any background noise such are knives hitting plates. These sounds are added later which ensures that they are at the appropriate mixing level and the appropriate time so as to not distract from the dialog
Furthermore, a lot of sounds are added that were not part of the scene that was shot, for example outdoor ambiance: The sounds of crickets are added to indicate that this scene is a t night -- even in cases where such sounds would not exist as is the case for highrise in New York for instance. Or African jungle sounds are added to indicate that one is in the wild, even though the scene is in Vietnam for instance.
There is one notable except to this and that is when recording background ambient noise or "room tone". When shooting on location, there is always some background noise. In every day life we get used to hearing that and don't even notice it. At some point during the shooting of a scene the background noise will be recorded in case it needs to be mixed in later. This will involve all the normal sounds emanating from the film crew and the background noise. So for instance if the air conditioner went on in an adjacent room for one take of a scene, but was off in separate take of the same scene, this would be very noticeable when the scene was cut together. This room tone recording would be used to smooth out the background noise so that the ambient noise would not be too jarring.
If you really want to get a feel of how much work goes into the sound design, you need to close you eyes and not look at the picture. One of the best examples is the opening scene in Apocalypse now. Try it for yourself and see. Well, not see, but you know what I mean.
From the wikipedia page on Foley Artists.
Here is a great website on how it's done.