Knowing which chords work well together, and which chords occur in each key, is fundamental to writing songs and chord sequences.
If you want to write a chord sequence to accompany a melody or an improvisation then you need to know which chords will fit together in a coherent way.