While it’s easier to remember which strings to use or the relative positions, it’s useful to notice the notes being played. For a open G chord, the notes in ascending order are G B D G B G, so alternating between the 6 or E string and the 4 or D string is moving between a G and a D. For an open A chord, the notes are A E C A E, so alternating between the 5 or A string and the 4 or D string is moving between A and E. For an open D chord, the notes are D A D F#, so alternating between the 4 or D string and the 3 or G string is moving between D and A. You’ll also see people move between the 4 or D string and the 5 or A string. Again this is moving between a D and an A.
What do they all have in common? The movement is between the 1st and the perfect 5th. These are the notes in a scale that resonate together best. There’s a bit of physics, specifically harmonics, behind why, but it just sounds good. That’s also why the 1st and the 5th are in both the major and minor chords, and why a power chord is the 1st and the 5th.