The only free and comprehensive online etymological dictionary of the Spanish language
que, qué (Interrogative Pronoun, Conjunction) "what;" "that;" "than"

10th cent. Old Spanish que "that;" 12th cent. qué "what." Semantically the result of a collapse of Latin quid "what" and qui "who" into a single word; phonologically the word comes from quem, the accusative of qui (see quien).

Also used as an interjection, ¡Qué casualidad! "What a coincidence!"

Indo-European: Celtic: Old Irish cía "who," Old Welsh pui> 'id.,' Old Breton pou 'id.,' Cornish pyw 'id.;' Germanic: Gothic ƕas "who," Old Norse hverr 'id.,' Old High German hwer 'id.,' Old Saxon hwē 'id.,' Old English hwā 'id.' (English who); Hellenic: Ancient Greek τίς (tís) "who," Thessalian κις (kis) 'id.,' Mycenaean jo-qi- 'id.;' Indo-Iranian: Sanskrit kím "what," "what for," Young Avestan cim "because;" Tocharian A kus "who," B kuse 'id.;' Anatolian: Hittite kui- "who," Cuneiform Luwian kui- 'id.,' Palaic kui- 'id.,' Lycian ti- 'id.,' Lydian qi- 'id.'