It originally didn't get much sunlight
Later materials identify Starkiller Base as having been built out of the planet Ilum, the planet used by the Jedi for their lightsaber crystals, which had already been an ice planet. Its original sun was Asar, which, according to the The Clone Wars episode "The Gathering", only rose on Ilum every nineteen days. It hasn't been established what this means astronomically (wouldn't some part of the planet always be exposed to the sun? maybe the Ilum system's cometary cloud is involved?), but the intent seems to be that Ilum was cold because it got very little sun.
Once the planet was converted into Starkiller Base, it was able to travel between systems to drain other stars, presumably including the star it drains near the end of The Force Awakens.