Tonic, dominant, and subdominant are a way of organizing the roles that chords play inside a chord progression. Roughly speaking, the tonic is stability, the dominant is tension and the pull toward resolution, and the subdominant moves the scene along. Once you know these three, it becomes easier to decide which chord to place next.
Tonic: the place that feels settled
The tonic is the central role that sounds most stable in a given key. In the key of C major, C is the typical example, and placing it at the beginning or the end of a song makes it easy to create the feeling of coming home. Chords such as Am are sometimes used as members of the tonic group as well.
Dominant: the pull that makes you want to return
The dominant creates the tension that makes you want to move to the tonic. In the key of C major, G and G7 are the typical examples. When you move from G to C, the tension unwinds and the music sounds settled. You will often hear this motion at the end of a chorus or at the break between phrases.
Subdominant: moving the flow along
The subdominant steps away from the tonic to change the scene and opens the way toward the dominant. In the key of C major, F and Dm are typical. The sequence C→F→G→C is one example of the basic flow: stability, motion, tension, and then a return.
Connecting them to diatonic chords
These functions are a framework for telling diatonic chords apart by role. Not every chord progression can be explained with only three types, but they help you understand the standard ones.
Trying it out when you write
If you build a short progression in your DAW, start from the tonic, pass through the subdominant and the dominant, and come back to the tonic. Repeat C→F→G→C, then change the order or swap one of the chords, and you can hear for yourself where the music settles and where it pulls.
