Investing heavily in the infrastructure of the Faroe Islands and Greenland gives Denmark leverage whenever those territories start talking about independence. Furthermore, it's increasing the standard of living for the people who live there, and having infrastructure in place makes it easier to attract businesses in the future.
There's also a cool-factor.