When playing the guitar, there is more going on than just creating what is heard.  Around all that you need to be in control of the rest of the strings, silencing any that are not being played.  For example, if you are playing the chord of D, the low E and the A strings do not get played.  So you need to cover those two strings so that they do not sound and add extra noise.  This is much more pronounced on an electric guitar.  Have you ever turned it up, put it on distortion, and then tried to play a power chord without covering the rest of the strings?  It is easy to get a lot of extra noise that fuzzes up your sound.  So whether you are playing chords or just one note, you need to silence all strings not being played.  I do this by using both hands.  In a chord like D, the thumb of my left hand (I play right handed) is coming over the neck of the guitar and touching the low E and A strings.  For a power chord I let the pointer finger of my left hand do the work, touching the rest of the strings so that they do not sound.  I use any free fingers of either hand to keep my sound under control, depending on what I am doing.  Different situations call for different solutions.  I also use parts of the palm of my picking hand to cover strings.  You need to find what works for you.  Feel it out.  As always, listen to how you sound.  Listen to every sound you make.  Being a great guitar player takes awareness and listening.  It also takes self discipline and the will to get better.  Have fun and Persevere!