Well- all the answers to date contain factual information. But none tell the whole story and might over complicate the matter.
The least you need to know is that the chord used as the basis for your question (D/A) is known in guitar chord notation parlance as a "slash chord". In simple terms, when a slash chord is used in guitar "notation" the author is telling you to play the chord before the slash - with the addition of the note after the slash as the bass note of the chord.
In the case of a D/A slash chord, this chord also happens to be an inversion of a D chord. In fact in most cases a slash chord will translate into an inversion of the chord preceding the slash.
But a "slash chord" does not always indicate an inversion of the chord appearing before the slash. It is likely to be an inversion of some sort. But not necessarily a simple inversion of the root chord.
But none of that technical stuff is important if all you want to know is how to play the indicated chord. See below from Wikipedia article on Slash Chords:
For example, a C major chord (C) in second inversion is written C/G, which reads "C slash G", or "C over G". If B were the bass it would be written C/B (making a major seventh chord in third inversion), which is read "C slash B"
So if you are learning a song and the chord notation notes a C/B - it is not necessary to know that the indicated chord could be more accurately described as a "major seventh chord in third inversion". There is really no need to know all that technical music theory stuff to play the chord.
All you really need to know is to play a C chord with a B as the bass note.
And another quote from the Wikipedia article on inversions:
For example, the C chord above, in first inversion (i.e., with E in the bass) may be notated as C/E. This notation works even when a note not present in a triad is the bass; for example, F/G is a way of notating a particular approach to voicing an F9 chord (G–F–A–C).
In the example quoted above - you don't need to know that a F/G is actually a particular voicing of an F9 chord (or an Fadd9 if you prefer) - all you need to know is to play an F chord and add a G to the bass.
If you do want to want to get your head around the concept of chord inversions, it is important to note that inversions on guitar are often more complex than inversions on piano. Often an inversion on guitar is more easily viewed as adding a bass note to the original chord. Again this makes it an inversion in the technical sense of the word, but the underlying chord may still be fully present in it's original configuration - except that now one other note has been added as the first note played.
For example in almost every case - the chord used in your question (D/A) - you play the D major chord just like you always would but you start on the A string instead of the D string.
On piano, with only 5 fingers (vs 6 strings) and the limitations on how far you can stretch those fingers, it is more common to play an inversion by shifting the position of the notes to start with one of the notes other than the root note of the chord (true with guitar as well). Except that with piano, an inversion is more likely to be a shift in the order of the notes whereas on guitar - it is often an addition of a different note in the bass but still maintaining the full root chord underneath.
But again, because a particular slash chord may or may not be an inversion of the basic root chord that appears before the slash, it is probably easiest for beginning guitarist (who aren't necessarily well versed in music and chord theory)- to just know to play the chord preceding the slash but adding the note after the slash as the first note played in the chord (bass note).
As others have noted, if you encounter a slash chord that is difficult to play with the fingering that might be required to add the note after the slash, you could simply substitute the chord before the slash.
But there is a reason the author of the chord notation indicated a slash chord. It is often part of a bass line incorporated into the guitar arrangement as others have stated. Or adding the indicated bass note might create an alternate sounding "voicing" that harmonizes better with the melody than simply playing the root chord.
Have fun adding more songs to your repertoire now that you know how to play slash chords ;-).