The region that would become New York was previously inhabited by the Native American tribes of the Algonquin and Iroquois.
In the early 1600’s the Dutch explored and named much of the area but later gave up the lands to the British.
In the late 1600’s New York was named for James Stuart who, at the time, was the Duke of York (a title of nobility).
James Stuart would go on to become James II, King of England.
Much later, in the 1920’s, a now booming New York City picked up the nickname "the big apple" via a writer for the New York Morning Telegraph who, at the time, was writing about horse racing.
The writer’s name was John J. Fitz Gerald and he continued referring to New York City as “the Big Apple” in later writings as well as other writers in different contexts.
Later in the 1930’s “the Big Apple” became a popular song and dance.