There's no agreed derivation of the expression 'hunky-dory'. It is American and the earliest example of it in print that I have found is from a collection of US songs, George Christy's Essence of Old Kentucky, 1862:
As sung by Christy's Minstrels.
Air - "Limerick Races"
One of the boys am I,
That always am in clover;
With spirits light and high,
'Tis well I'm known all over.
I am always to be found,
A singing in my glory;
With your smiling faces round,
'Tis then I'm hunkey dorey.
The Christy Minstrels were a 'blackface' minstrel group formed by Edwin Pearce Christy, George Christy's father. Both men were born in the USA, but Christy is an Irish surname and the tone of the above lyrics, along with the Limerick-based tune, all point to an Irish association with the phrase.
Not long afterward, in October 1866, the US magazine The Galaxy, seemed unclear why the phrase was used, which also indicates that it wasn't very long in the tooth at that date:
"I cannot conceive on any theory of etymology that I ever studied why anything that is 'hunkee doree', or 'hefty' or 'kindy dusty' should be so admirable."
That citation does at least suggest that 'hunky-dory' was in common enough use in 1866 for the author not to see fit to explain its meaning, although it's a pity 'hefty' and 'kindy dusty' weren't explained as these have now disappeared from the language. It seems that The Galaxy writer had been perplexed by the recent popularity of the the expression, which appears in several publications in 1866; for example, The Galveston Daily News, June 1866, had this piece of advice:
In the morning wash with Castile soap, in soft rain water, and you are all "Hunky-dore" - as fresh as a lily - as sweet as a pink.
We do know that 'hunky-dory' wasn't conjured from nowhere but was preceded by earlier words, that is, 'hunkey', meaning 'fit and healthy' and 'hunkum-bunkum', which had the same meaning as 'hunky-dory'. 'Hunkey' was in use in the USA by 1861, when it was used in the title of the Civil War song A Hunkey Boy Is Yankee Doodle. 'Hunkum-bunkum' is first recorded in the US sporting newspaper The Spirit of The Times, November 1842:
"Everything was hunkum-bunkum for immediate flight."
It's clear that the 'hunky' part of 'hunky-dory' is from the above usages. What isn't clear is how 'dory' came to be added.
By 1877, John Russell Bartlett suggested a Japanese influence. The 4th edition of Dictionary of Americanisms includes a definition of an earlier spelling of 'hunky-dory':
Hunkidori. Superlatively good. Said to be a word introduced by Japanese Tommy and to be (or to be derived from) the name of a street, or bazaar, in Yeddo [a.k.a. Tokyo].
Japanese Tommy was the stage name of the variety performer Thomas Dilward, popular in the USA in the 1860s - and conspicuously not Japanese. Dilward was a black dwarf before cosmologists ever thought of the term.
There is no direct evidence to support Bartlett's supposition. It is highly unlikely that Thomas Dilward ever visited Japan, but he may have popularised the expression which he could have picked up from those who had. Commodore Matthew Perry had opened up trade with the country in the 1850s and there were frequent voyages between the US and Japan by to the 1860s.
The Japanese term 'honcho-dori' means something like 'main street' and many cities there have one. US sailors would have known the word 'hunky' and could have added the Japanese word for road ('dori') as an allusion to the 'easy street' they found themselves in in Japan. There certainly were 'honcho-dori' streets of easy virtue in Tokyo and Yokohama that catered for the age-old requirements of sailors in port after a long voyage.
As I said at the outset, we can't be sure.
See other phrases that were coined in the USA.