In a nutshell, the French reputation for cowardice is only marginally linked to WW2: it's a byproduct of the 2003 invasion of Irak by the US, whose administration supported a smear campaign that targeted France for opposing the invasion. The campaign dug up and weaponized every negative stereotype it could find about the French, including centuries-old Anglo-French bickering, and a bunch of anti-French gripes reported by GIs after WW2. Denmark was not targeted by the campaign (it was part of the US-led coalition) and neither were other countries rolled over by Nazi tanks in 1939-1940, so they were not called cowards by US politicians, pundits and entertainers in 2003. More can always be said, but here's my recent answer about this.
I can see that the subject of French “cowardice” has been discussed in another comment, so let me focus on why the perception of Denmark after WW2 might have been slightly more merciful:
First of all, I think it might be more helpful to compare the Danish reputation post WW2 to the Swedish reputation rather than the French. While Sweden openly acted as a neutral party during the war, the Danes established an equally well-known collaborative policy during the first years of occupation. In the decades after the war (and even know) this became a topic of debate: Should the Danes feel ashamed of the lack of resistance and the coorporation with the occupying force or was it a necessity due to the overwhelming military power of Nazi Germany? This collaboration became a point of criticism during the war (such as preventing Denmark in joining the early stages of UN) and it might very well have resulted in a backlash after 1945 as it did for Sweden.
There are, in my opinion, two main reasons why Denmark faired quite well post WW2: 1) The evacuation of the Danish Jews in 1943 (in which, I would like to add, the neutrality of Sweden played a crucial part) and 2) Danish propaganda in London aimed at occupied Denmark and the Allied powers. I will focus on the latter since it is the lesser known of the two and more difficult to google for non-Danish speakers.
During the war, Danish politicians and people in the resistance movement realised that the collaborative policies established by Denmark after April 9th 1940 could impact Denmark negatively after the war. In order to combat these narratives of a German-friendly Denmark, outreach-projects were created to tell the Danish side of the story. Most of these narratives was aimed at the Danes themselves through BBC broadcasts from London to Denmark though some were aimed at the Allied powers.
Let us start by looking at the broadcast from London to Denmark:
Unlike other occupied countries (such as Norway) the Danish collaboration policy meant that it was legal to listen to these broadcasts and they became a point of frustrations for the Nazi occupying forces who sought to disturb the broadcasts using “støjsendere” (I am not sure of the correct English translation. Perhaps “noise pollution”?).
Due to the quick and “cowardly” surrender of the Danish forces on April 9th 1940, the Danes residing in London had to argue their case in order to get the broadcasting time extended from five minutes to several broadcasts a day. The goals of the Danish broadcasters (after a year of soft-peddling broadcasts) became to promote any sign of anti-Nazi action in Denmark and so the BBC broadcasts became a vital part in promoting and strengthening the Danish resistance movement in collaboration with the British Special Operation Executive.
This London based narrative of a fighting Denmark was hindered on an organisational level. The official Danish government in Copenhagen were speaking out against any Danish resistance in order to secure the collaboration efforts with Nazi Germany, and so the anti-Nazi Danish narrative based in London needed something similar.
In contrast to other occupied countries, Denmark did not have a government in exile (due to the collaboration policy) and so there were no official entity to negotiate with the British. “Det Danske Råd” (the Danish council) were created consisting of local residents (journalists, engineers etc.) who found themselves in London at the outbreak of the war.
Though the council had no official capacity it acted as a source regarding all things Danish both for journalists and for the British government. They became vital in creating an anti-Nazi stance for Denmark through publications (with Attlee writing one of the prefaces calling Denmark “an ally in all but name”) and exhibitions on the Danish resistance movement (in Bond Street at The Royal Copenhagen Porcelain Galleries). The exhibition was later moved to Paris and Marseilles to promote the Danish anti-Nazi narrative there.
Through broadcasting strengthening the Danish resistance movement and a carefully constructed narratives of a “Fighting Denmark” (as the exhibition was called) aimed at the Allied forces, Denmark managed to convince the allied forces that although the Danish government had been collaborating with Nazi Germany, the Danes themselves had been resisting all along.
DISCLAIMER: I would normally describe my area of expertise as 16th and 17th century European court culture, but for reasons quite mysterious I stumbled upon this tiny detail of WW2 during my studies at university. Reading this question on reddit, I simply had to go find my old exam paper on the topic. I hope there is someone on reddit with greater expertise than I, who can expand upon this. Until then, I can link some of the photos from the exhibition “Fighting Denmark” from 1944 found in the Danish Royal Library:
Bond street and the Royal Copenhagen Porcelain Galleries
EDIT: Apparently, the links do not work. I will have a look at it tomorrow.
EDIT 2: I think they work now.
Some sources:
Bennett, Jeremy: British Broadcasting and the Danish Resistance Movement 1940-1945. 1966.
Gundel, Leif: Her er London. 1945.
Terkelsen, Terkel M.: Særmelding fra London. 1971.