It's because of the tilt and the seasons and the the way on the earth it's located. During the summer it has long days of sun and some days have 24 hours of sun and in winter there might be only 3 hours of sun and total darkness.
Alaska experiences long days in summer and short days in winter due to the tilt of the Earth's axis. During the summer solstice, much of Alaska enjoys nearly 24 hours of sunlight, while in winter, it can have only a few hours of daylight, especially in the far north. This seasonal change in daylight is more pronounced the further one is from the equator.
;