This problem is addressed almost weekly here. there are many past posts to this problem.
Water does not compress, so it strikes fittings and pipe much like a solid object when it stops suddenly against a turn in the pipe run. Air does compress, so a moving column of water will compress air before it, often the water strikes a fitting in the process, making a loud noise.
It is necessary to eliminate the air before it collects in a long pipe run. Air comes in from the water lines; about 5% of fresh water is air by volume. If the water had no air, it would taste flat. Excess air can be eliminated by venting it at the water heater, water softener, or other collection point along the cold water supply.
Finding the location of the banging and air collection takes some time, but much searching can locate the spot. It is usually at a high spot in the run, if the tubing or pipe is properly plumb.
Some may elect to place a water hammer arrestor, a type of restricted air chamber at the end of the run where the noise occurs.
This can take some time and is a learning experience for the novice. Much time and inconvenience can be prevented by calling on the services of an experienced plumber.