When a guitar string is plucked, it starts vibrating. This vibration causes the air molecules around the string to vibrate as well. These vibrations are what we perceive as sound.
The pitch of a sound is determined by the frequency of the vibration. The higher the frequency, the higher the pitch. The amplitude of a sound is determined by the amount of energy in the vibration. The greater the amplitude, the louder the sound.
The timbre of a sound is determined by the shape of the waveform. The waveform is a graph of the amplitude of the sound over time. Different instruments produce different waveforms, which gives them their characteristic sounds.
In the case of a guitar, the sound energy comes from the vibration of the string, which causes the air molecules around the string to vibrate. These vibrations are then transmitted to our ears, where they are perceived as sound.