Alaska was named by people who were looking at it from the sea. The name is an Aleut word, and it first meant only a peninsula.
Etymonline says Alaska comes from the Aleut alaxsxaq, which it glosses as "the object toward which the action of the sea is directed." Wikipedia and Wordorigins.org give the shorter sense, "the mainland." The longer gloss would describe a coast as the thing that waves are pushing toward, the solid ground next to open water.
Russian explorers picked the word up in the 18th century. Etymonline says they applied it to a large peninsula in northwestern North America, which Wikipedia and Wordorigins.org identify as the Alaska Peninsula. Wikipedia says the name was introduced during the Russian colonial period, with the Russian form written Аляска (Alyaska). Over time the label spread from the peninsula to the whole territory.
The "action of the sea" gloss deserves some caution. Etymonline credits it to an earlier reference work rather than giving its own analysis, and Wordorigins.org gives only "mainland." The exact Aleut spelling also varies between sources. So the safest statement is that the name is Aleut and means "mainland."
The first English appearance of the name that Wordorigins.org knows of is a 1774 map labeling the peninsula "Alaschka I." The spelling "Alaska" appears by 1784 in Cook and King's A Voyage to the Pacific Ocean.
The colony that followed was Russian America. Wikipedia says the first permanent European settlement was founded in 1784, and Sitka was the capital, called New Archangel from 1804 to 1867. In 1867 the United States bought the territory from Russia for $7.2 million. Critics called it "Seward's Folly," after Secretary of State William Seward.
Alaska became the 49th state on 3 January 1959. The name that Russians borrowed from the Aleut for one peninsula now covers the largest state.