Samsung Galaxy S5 supports Auto Focus feature for high quality and resolution of camera. There are Lens Units of 16MP and Image Sensor inside the camera module, which Auto Focus feature will adjust focus by moving the Lens Units up and down.
To adjust focus, it require minimum spaces for movement of the Lens Units and there is Stopper part fix to move the Lens Units within permitted limited space.
When the Lens Units and the Stopper touched during shaking, noise can be heard. This is a normal operation and the device is not faulty.