The word candy found its way into English as early as the 15th century. However, it was not until the 17th century that it came to be used as a standalone noun. At first, it was used in a compound word — sugar candy, a usage you will still hear occasionally. The term sugar candy came by way of French and Italian from the Arabic sukkar quandi, meaning “candied sugar.”

Sukkar came from the Sanskrit word sarkara, which originally referred to granular particles, grit, or gravel, but came to also mean crystalline or “granular” sugar. This usage shows, according to the ancient sources available, that granular sugar was being manufactured from sugar cane perhaps earlier than 500 B.C., but at least as early as 324 to 300 B.C. Before this, sugar cane would have been used for its juice.
Quandi (or qandi) came from the Sanskrit word kanda, meaning piece or fragment, through Persian to Arabic as Sukkar quandi to mean “sugar piece” or “candied sugar.” This term became the Old French sucre candi, which passed into Middle English as sugar candy, to refer to a hard crystallized sugar. Not until the 17th century did the word “candy” come to be used alone.
See Candy Making Sugar Stages.
Sugar candy, during Medieval times, was a hard candy consisting of lumps of crystallized sugar, sometimes known as rock candy. This name is still in use, although it is not heard very often.
Candy is used to refer to sweet treats much more liberally in the U.S. than in Britain, where it is restricted to actual sugar candy, rather than sweets made with other ingredients such as chocolate, fruit, nuts, etc.