Why do hitting a surface of an object generates sound?
Sound is simply the physical vibration of a material, which is eventually transferred to the brain through similar vibration of the eardrums. Usually, that vibration is carried via air to the ears, but the same result occurs in water or directly if you have your ear against the original source. Hitting an object sets up the vibration in the first place, governed by the properties of the material. Vibrations in rubber, for instance, are damped out almost immediately, whereas something like a tuning fork can keep going for ages.
May I ask a stupid question regarding this. In hot days, the particles of the air are vibrating more, so shouldn't we hear a sound?
The distribution of velocities in thermal motion is equal in all directions. So on average (and our eardrums are averaging devices) an air molecule going one way will cancel out with another one going the other way.
I suspect that when I hit a heavier object, the frequency of the sound produced is always lower than when I hit a lighter object. I don't know whether this is generally true.
That is not strictly true, although it tends to be the case with identical substances of different mass. I suspect that it's simply because more of the vibrational energy in a large object is dissipated internally. On the other hand, the shape and accoustic characteristics of different objects can reverse the tendency. Hitting a large church bell with a hammer, for instance, will produce a higher pitched sound than hitting brick with the same hammer even though the bell might weigh a couple of tons.
Shape is a very important factor as that governs the possible wavelengths (OK technically all wavelengths are possible, but at least it governs the likelier wavelenths). Mass density is also important as it enters the equation in the proportionality factor between the space and time derivatives.
Separate names with a comma.