A song called "Josephus Orange Blossom", sung by the Christy Minstrels during the Civil War, contained the line "red hot hunky-dory contraband". The tune was a big hit and the phrase became part of the popular slang of the period.
I'm not sure where they got "hunky-dory" from, but it seems that was its first use.
The other origin appears to be a derivation of the Dutch word "honk" meaning "goal" or "home".
The "dory" bit would then be a bit of reduplication, as in "okey-dokey"