Insomnia is a medical word English took from Latin without changing a letter.
The Latin noun for sleep was somnus. Put the negative prefix in- in front and add an adjective ending, and you get insomnis, "sleepless." Add the noun ending -ia and you have insomnia, the state of being sleepless. Dictionary.com breaks the word down exactly this way.
When English adopted it is less settled than you might expect. Merriam-Webster gives 1739 as the first known use. Dictionary.com places the first record earlier, in 1685 to 1695. Either way, the word arrived in the age when physicians wrote and borrowed freely from Latin.
The person who suffers from it had to wait much longer for a name. Insomniac is first recorded in 1905 to 1910, formed from insomnia plus the suffix -ac. Dictionary.com also lists a rarer adjective, insomnious, for anyone who prefers a longer word.
Somnus turns up in several other English words about sleep, and they arrived at different times. Somnolent, "sleepy," came into English in the late 1400s through Anglo-French. Merriam-Webster notes that it first appeared in the redundant phrase "somnolent sleep." Somnambulism, sleepwalking, is first recorded around 1790 to 1800. It came through French from New Latin, which built it from somnus and ambulare, "to walk."
The root goes deeper than Latin. Merriam-Webster links somnus to Greek hypnos and Old English swefn, both words for sleep. So insomnia and hypnosis are distant cousins. One names the sleep you cannot reach and the other a sleep-like state someone puts you into. The sounds drifted apart over thousands of years, but the meaning held.
For anyone lying awake, the word offers small comfort. The Romans had the same complaint and a word for it, and English simply borrowed theirs.