Denmark has never really held Greenland in a meaningful way and never wanted to. A little history: Vikings maintained a small settlement in Southern Greenland going back to the 12th century or so, and accepted Norwegian overlordship in the 13th. Norway and Denmark were combined in personal union under the Danish Oldenburg dynasty over the 16th-17th century. When they were forcibly split in 1814 by the British after the Napoleonic Wars, Denmark wound up with the settlement.
After the civil war United States sent explorers to the rest of Greenland and claimed it, which prompted the Danish to claim it too. We then recognized the Danish claim as part of the purchase of the British West Indies in 1917, and successfully prevented the British from buying it for Canada or getting a right of first refusal to prevent us from getting it. So in 1921 Denmark was stuck and actually had to declare sovereignty over the whole island. Sort of.
fast forward to WWI- Denmark is occupied by the Germans, who then make moved in preparation to invade and occupy Greenland, so we put the coast guard in place and begin to set up bases, and there we have been ever since.
Greenland is essential to US strategic defense. Holding it is consistent with the Monroe doctrine, and because the current Danish claim is a post 1823 European colony we tolerate it as an exception.
I’m glossing over a lot and some details may be wrong, but that’s the gist.