late 14c., "that which is hidden from human understanding;" early 15c., "that which is hidden from general knowledge;" from Latin secretum "secrecy; a mystery; a thing hidden; secret conversation," also "retirement, solitude," noun from secretus "set apart, withdrawn; hidden, concealed, private." This is a past-participle adjective from secernere "to set apart, part, divide; exclude," from se- "without, apart," properly "on one's own" (see se-) + cernere "to separate" (from PIE root *krei- "to sieve," thus "discriminate, distinguish").
The meaning "something studiously hidden or concealed; what is not or should not be revealed" in English is from mid-15c. The sense of "key or principle by which some difficulty is solved" is from 1738, perhaps via the notion of "method or process hidden from the uninitiated" (late 15c.).
The alternative form secre, from an Old French variant form of secret, was common 14c.-16c. and seems to have been more frequent originally. It also was a variant of the adjective.
Open secret "matter or fact which is known to many; a secret which all who care to may learn" is from 1828. To keep (a) secret is from mid-15c. Secrets "parts of the body which propriety requires to be concealed" is by 1530s.