a friend I met at the train station played very nicely on the piano in the train station. I asked him how harmony in music works. he told me that I need to learn about “the Counterpoint” and that I can find it Online.
He has also told me that counterpoint is how multiple melodies interleave, and chords are just result of counterpoint.

the following link is the best link I have found about the Counterpoint:
http://sethmonahan.com/teaching.html