There is no known etymology that stands up to examination. It was always originally a military term...firstly, referring to a Royal Navy officer who was thought to be rather long in the tooth. Later, it took on the meaning of a scientist or back-room boy, especially in the RAF, in respect of those working on early radar systems. Nowadays, it just means any form of scientist or researcher.