The settlement of what is today's municipal district dates from the Neolithic period, of which remains have been found in the Santa, Chamusquina and Castillejo caves. The area was subsequently home to Iberian settlers, who remained until the Roman era.
The site where the town stands today was first occupied in the early 16th century, when the inhabitants of Zahara took up residence, attracted by the fertile lands and the abundance of water. It takes its name from the crops grown in the area nearby (cotton means "algodón").
Pillaged and burnt by the French in 1810, it was awarded its village status in 1817 in recognition of its inhabitants' opposition to Napoleon's army during the War of Independence.
Today it is internationally famous due to the excellent paragliding conditions to be found in the Sierra de Lijar.