There are different ways to see it. Your E minor pentatonic fits there, because the notes of the E minor pentatonic added to an A major chord either support the A major, or add to it creating more complex chords. Additionally the G note does something that's not found in plain A major scale, making it a dominant chord (A7). When vamped over instead of resolving (to e.g. a D chord), you can think of a dominant chord as sounding bluesy or jazzy.
Let's see which chord is created as a result of adding each of the notes of the E minor pentatonic scale:
- (1) A major + E : A major
- (2) A major + G : A7
- (3) A major + A : A major
- (4) A major + B : Aadd9
- (5) A major + D : Aadd11, or if the others are just playing an A "power chord" without C#, then D added to it is an Asus4.
Or if you think that you're playing all of the notes at the same time, arpeggiating a chord, or actually playing them as a chord, and leaving out the notes that are already in A major (E and B), you create
- A major + G + B + D = A11. An A11 chord is: A, C#, E, G, B, D.
... and G+B+D is G major - so depending on how you play the notes, you might be making it sound a bit like the chords A major and G major are alternating. The combined notes from A major and E minor pentatonic (A, B, C#, D, E, G) are the same as a combination of A major and G major triads.
Or you can think that you're (almost) creating the sound of the A mixolydian mode, if the backing chords stay in A major all the time, keeping the tonic fixed to A. (The feeling of a tonic i.e. home note is required in modes) The A major chord has the notes: A, C#, E. Add the notes from E minor pentatonic, and you get A, B, C#, D, E, G. The only thing missing form A mixolydian is F#.
Why does it sound good? Maybe you like the sound of the A mixolydian mode or the A11 chord. Maybe you like being able to create a harmony that's a bit more interesting than plain vanilla pop songs, and you can do it without playing any wrong notes? Who knows. I tried it, and I got tired of playing E minor pentatonic on an A major vamp after about two minutes. :) ... edit: it became more interesting again after awhile, when I forced myself to just keep playing and find different things to do with the notes. ;)