Some older folks spell goodbye with a hyphen like so: good-bye. Initially, the phrase wasn't even just two words. There were four. The original phrase was God be with you. This was a farewell often used in the late 16th century. It's such a nice thing to say. I still hear it once in awhile but not often enough.
Over time, the phrase was reduced and shortened. We can see examples of its shrinking in text like Shakespeare's God be wy you and God buy' ye. By the 18th century, the word God had been replaced with good and the appearance of good-bye was prevalant. It's possible that the substitution of God with good is the result of influence of other phrases like good day and good night.