The ice on Greenland formed due to processes in the deep Earth interior of the Arctic, large-scale glaciations that began about 2.7 million years ago. Prior to that, the northern hemisphere was so warm it was mostly without it, and that period lasted for 500 million years.
The big question geologically is why the glaciation of Greenland only developed so recently.
It's because of the interaction of three tectonic processes. Greenland literally had to be lifted up, so that the mountain peaks reached into sufficiently cold altitudes of the atmosphere. Greenland also needed to move sufficiently far northward, which led to reduced solar irradiation in winter. Then a shift of the Earth axis caused Greenland to move even further northward.