The D4 chord, often called a D4sus (suspended) chord, is used in piano music to create a fuller, more interesting sound in certain songs. The "4" in the chord suggests the presence of a note that is a fourth above D, which happens to be the G note. You can learn to play a D4 chord by understanding the notes involved and investing a little practice in playing those notes.
Place your right thumb on a D note. The D note is a white key located between the two black keys in a set.
Place your fourth finger on G. The G note is a white key that is located between the first and second black key in a set of three black keys.
Place your fifth finger on A, which is the next white key to the right of G.
Play the D, G and A at the same time in order to play a chord. Play the notes in sequence in order to play an arpeggiated chord.
Add the same notes with your left hand or simply add two D notes by using your left fifth finger and thumb. This supplies the bass for the chord.