Around the perimeter of the docking system are a set of 12 spring-loaded latches that lock the two spacecraft together. I believe the latches trip as the retractable probe pulls the two spacecraft together making a tight seal. The bang-bang-bang is the sound of the latches locking into place; I don't know how the timing heard in the movie corresponds to the actual timing of the sound, but I agree that this is the kind of thing the movie mostly gets right.
The latches are shown in blue here in these pictures taken from the Apollo 13 flight journal, which has a fair amount of information about the TDE maneuver and docking:
The Apollo 17 flight journal has an annotation describing the latch action:
This drogue has a circular hole at its apex and the probe has three captures latches around its tip. These are arranged to catch on the inside lip of the hole in the drogue. When they do to, they are said to have captured and this is a soft dock. The tip of the probe is articulated and damped to accommodate any slight misalignment of the two craft and any rotation one might have with respect to the other. When such rotations have damped out, the probe is pneumatically retracted while three pitch arms ensure proper alignment of the two craft. This brings the two faces of the tunnel together where 12 spring-loaded docking latches trip to fasten the two spacecraft as one, the so-called hard dock. The docking latches engaging in quick succession produce a distinctive ripple-fire sound.