The top one, ISN'T how you originally described it (a bar chord of the top 4 strings). Obvs the position on the D string is different. Thus its a different chord.
A "bar" on the top 4 strings would be the notes (let's say the bar is at fret 2): E A C# F#, which is A6 (but the root isn't at the bottom of the chord, so you could describe it as A6/E if you wanted to....but with guitars, I bet someone else is playing the root.....)
Chords aren't massively complicated on a guitar: There's 2 shapes, the "E" shape and the "G" shape. A and D open chords are the same as E but shifted down a string or two; C open chord is the same as G shifted down a string. Then there's variations on stuff, ie minor/major, adding 7th, 9th, #9, etc. Then there's playing just the top 3 or 4 strings, or the bottom 3 or 4, etc