Music is one of the greatest outlets of human creativity. With the most basic of materials, cultures around the world have managed to create a wide range of sounds and bring them together into an infinite variety of songs that can provoke emotions from joy to sorrow. Looking at the acoustic guitar is a great way to understand a lot more about how this works.
Though an instrument has many parts, the foundation of producing sound for a guitar is its strings. Once a spring has been attached, a musician can pluck it to cause it to vibrate. This vibration is what translates into the sounds that we actually hear. Plucking harder makes a stronger vibration, and therefore a louder sound. It does not, however, change the note that is played. This is done during a song by pressing the string down against the frets to change its effective length, which changes the frequency at which it can vibrate.
The strings can not, by themselves, create a great deal of sound. People often do not realize how important the soundboard, or top, of the instrument is to the sound that it makes. The strings transmit their energy into this, and then it is the soundboard that has the large surface area needed to transmit that vibration into the surrounding air so that it becomes something we can hear. Because of this, using different types of wood or attaching it to the rest of the guitar in slightly different ways can make subtle adjustments to how the sound comes out.
Typically, there will also be a hole in the soundboard. This is often a circle cut out directly under the strings, but there are some makers who carve holes in a manner similar to instruments in the violin family. These are placed there to let the vibrations within the body escape to resonate with the ones outside of it.
This basic outline of how musical notes can be created with a guitar should give you a sense of how much artistry, skill, and complexity goes into making an instrument that can perform up to our expectations. It has taken many generations of effort to reach the point where we can enjoy the beautiful music produced by a modern guitar.