Answer
Margrethe II was named for her great-grandmother, Margrethe I, who was the founder of the Kalmar Union, a political union that united Denmark, Norway, and Sweden under a single monarch. Margrethe I was a powerful and influential ruler, and Margrethe II was named after her in the hope that she would follow in her footsteps.