When two things hit against each other, they set up a vibration that reaches your ear as a sound. Different things make different vibrations when they hit, and that’s why you hear high notes and low notes. Things that vibrate quickly make small waves in the air, and that sounds to you like a high-pitched note. Things that vibrate slowly make longer waves in the air, that sound to you like a low-pitched note. Your ear can only hear a limited range of sounds: if the sound waves are too short or too long, you won’t hear them at all. (Dogs can hear shorter waves than people can).
Things that are tighter, shorter, thinner, and less dense make shorter sound waves and higher sounds, while things that are looser, longer, thicker and denser make longer sound waves and lower sounds. On a guitar, all the strings are the same length, but the thicker strings make lower sounds and the thinner strings make higher sounds. Also, the thicker strings are made of a different, denser metal. You can also change the pitch (how high the sounds are) of the strings by tightening them or loosening them using the pegs at the end of the neck.
Check out how using sound to vibrate this metal plate makes the salt on it move around in patterns as the sound waves bump into each other and bounce off each other: