What do they learn through banging?
Your baby's learning about cause and effect, about their own body and about the force they can use to get a reaction. They are getting to use their senses as they experience touch, sight, sound, proprioception (their sense of their own body) and often taste, during their explorations.
Gearing up to use tools
Research has also shown that banging movements are an important step in the development of tool use for children. Psychologists Kahrs, Lockman and Jung showed that as babies practise banging, their movements undergo developmental changes to become more suited for hammering tasks in later life.
So, although it might look (and sound) like a chaotic mess, giving plenty of time and space for your baby to bang, crash and hit objects is a powerful way for them to refine their skills for later tool use.
References:
Kahrs, B. A., Jung, W. P., and Lockman, J. J. (2012). ‘What is the role of infant banging in the development of tool use?’. Experimental brain research, 218(2), 315–320. [Available online] https://doi.org/10.1007/s00221-012-3062-3