疒 is illness q.v., and 顚/顛 is upside-down q.v. acting as phonetic, and could have lent all sorts of meanings from being upside-down, like being upset or not normal. Someone who has an illness whereby one is upset and/or not normal is mentally unstable or crazy. Note that even in modern Japanese in compounds 顛 often has the meaning of being upset.
Mnemonic: You’re crazy if you’ve got an illness being not normal, upset, upside-down.
癲 is a combination of the signific 疒 disease (see below) and a character that here is acting as phonetic, 顚/顛 (see below). 顛 is the modern form. Note that even in modern Chinese 顚/顛 and 癲 stand for identically pronounced words or morphemes: diān. Further, as phonetic diān 顚/顛 seems to lend more than just its pronunciation. The original word diān carried the meaning ‘person upside-down’ (later more generally ‘overturn; topple; fall down; be overthrown’). Upside-down is in many languages a way to express being mentally unwell and Chinese is no exception. Confusingly, 顚/顛 is also used for a different word with the meaning ‘top; summit’.
疒 is Kangxi radical 104 sickness/illness. The left part originally depicted a bed while the remaining part according to Henshall (381) used to be a variant of person 人 (a person on bed, conveying being ill). Henshall writes that the left side of 疒 was derived from the left side of tree 木 (half a tree) thereby conveying a plank. In the seal character shape (see the picture at the right) 疒 looks more like a real bed, with legs, seen from the side, turned 90 degrees (but in that variant 人 seems absent). In its modern shape 疒 seems to have more in common with 广, which originally depicted a large building.
顚/顛 consists of 眞/真 (on itself now used for an unrelated word) and head 頁 . 眞/真 can be further analysed as inverted head 県 (from 首) and fallen person ヒ, expressing person upside-down (leading to more modern meanings like overturn). The extra head 頁 was added to separate 顚/顛 from the unrelated word 眞/真 had gotten used for. As often the seal characters (see the right) give a better idea of the pictographic nature of the elements (頁 being an exaggerated head with legs bungling underneath, 首 having hairs on top, hence the hairs on the bottom-side of the inverted head 県, etc. See Henshall 93, 139, 273, 514 for more on the full history of these elements; see also Wieger 10 L and 160 A).