Originally it was written as 減気 (genki), with the 減る kanji signifying a reduction, or retreat of illness (病気が減る). Then it morphed into 験気 (meaning whatever treatment was admistered had been having the desired effect), and then finally it morphed again into 元気, meaning the person/patient had returned to his original state of health.
元 origin, original, in addition to meaning "former"