All of these spellings are legitimate; but if you want to go with the most popular one, it’s “goodbye.”
This spelling has the advantage of recalling the word’s origins in phrases like “God be with ye.”

kthxbye: shortening of "k thx bye". The K is short for OK, which is short for oll korrect, which is a facetious alteration of All Correct. thx is short for thanx which is a facetious alteration of thanks which is short for thank you. Bye is short for goodbye, which is an alteration of alteration of God be with you. kthxbye is the pinnacle of English's advancement, shortening All correct, Thank you, God be with you. into seven lowercase letters.

Urban Dictionary isn't the most reliable of sources. Some people would also claim that "kthxbye" more closely resembles the nadir rather than the pinnacle of the English language. You might want to consider finding a different source altogether.
–
kitukwfyerAug 20 '10 at 20:00

2

The answer doesn't explain the origin of goodbye, which is what the OP asked.
–
kiamlalunoSep 5 '10 at 8:21

+1 for mentioning lolcat, the pinnacle of english language.
–
Jim ThioDec 17 '11 at 4:28

I took "pinnacle" to be tongue-in-cheek. You have to admit that 8 words in 7 lowercase letters is quite the "achievement"!
–
meustrusJul 25 '14 at 21:56