Why is it that on most airliners, when the landing gear gets deployed, you always hear a loud noise like a bang. Is this due to the equipment locking in place or is there some other reason? As an external person I would think that there should be a mechanism that pushes it down slowly, avoiding this noise but it doesn't seem the case.
The locks release and typically the gear falls free into place. It is often aided by hydraulic motors (i.e. to overcome anything that might be trying to hold the gear up, such as slush from the takeoff runway that froze after the gear was in the well), but most landing gear will freefall into place within a couple of seconds even without hydraulic assistance after the uplocks are released.
What you're probably hearing is the sudden onset of the wind noise -- when retracted the landing gear is streamlined, but when extended there is now an open cavity where the gear had been, and this open area in the fuselage creates a lot of wind noise from the suddenly turbulent airflow. Going from a relatively quite state to a loud one suddenly gives the impression of a "bang." This is possibly enhanced by whatever noise is made by the uplocks that hold the landing gear in place releasing, and perhaps some louder noise as the initial moments of the gear extension may be noisier than the steady-state noise of being fully extended.
Also, the noise due to the turbulence will subside as the airspeed slows, and extending the landing gear often comes during a phase of flight when the airspeed is being reduced in preparation for the final approach segment and the subsequent landing.
These can be quite significant (scary) events on some aircraft. A Bombardier CRJ aircraft, especially if you are sitting around rows 8-12 near the hydraulic bay and wheel wells, can be a jolt even if you're prepared for it. I agree with Ralph J and his answer is quite good. I would like to add a couple of items: 1) An intital "bang" that you hear before the start of the wind noise is either the door uplock or landing gear uplock that is releasing or the hydraulic selector valve that is now porting hydraulic pressure to the uplocks and actuator. A typical design would have an electric solenoid valve open which directs hydraulic pressure to one side or another of a valve that slides over and opens a port to send the hydraulic pressure to release the uplocks and actuators to power down the gear. The solenoids act very quickly (within miliseconds) and when you have a hydraulic system at 3000psi the valve moves very quickly and you get a hydraulic "hammer" from the almost instant change in pressure. 2) The noise when the gear is finished retracting and the wind noise has gone away is typically the uplocks locking and is basically the reverse of #1.
Normally you sequence the release of the door locks and gear uplocks before the actuator starts to pressurize, but if its not quite timed right you can get some force built up on the uplocks and when they unlock there can be some noise. But normally the "bang" is the hydraulic pressure. You could make this event less dramatic by adding in restrictors and sequencing in the system, but you are adding cost, complexity and weight, and may reduce reliability by having additional failure modes or possible clogging. As in all things in aerospace, it is a trade between weight, cost, reliability and performance.
Beyond whatever particular sources of noise might be associated with an given airliner's landing gear deployment (unlatching, hydraulic pumps, drag brace latching, wind), it should be noted that the sound of a landing gear free-falling into position is not one of them.
Landing gear don't free fall. Under normal operation, the rate of downward motion as the strut swings into position is regulated by a hydraulic cylinder (e.g. deployment time would be similar even in zero gravity). Even for a zero-hydraulic-system-pressure "hydraulics out" condition, deployment rate should appear close to nominal because hydraulic fluid already in the cylinder has to be forced out (by the weight of the landing gear) through a relatively small outlet.
A true free-fall would only result from something like fracture of the hydraulic cylinder's piston rod. In videos of this FAA-required test, a shock strut (typically with deadweight in place of the tires/wheels/brakes) will be seen rapidly swinging to its full down position with tremendous noise and shock at the conclusion.