With my years-long battle with my danish macintosh keyboard, it seems that I have now fallen over a solution.
My ubuntu 21.04 is using english as language and a danish keyboard.
I did a install of the danish language: sudo apt install language-pack-gnome-da.
Then I changed to the danish language and then back again to english, and my keyboard now works properly.
Even the funny danish letters are made properly.