Old English hwile, accusative of hwil "a space of time," from Proto-Germanic *khwilo (cf. Old Saxon hwil, Old Frisian hwile, Old High German hwila, German Weile, Gothic hveila "space of time, while"), originally "rest" (cf. Old Norse hvila "bed," hvild "rest"), from PIE *qwi- "rest" (cf. Avestan shaitish "joy," Old Persian šiyatish "joy," Latin quies "rest, repose, quiet," Old Church Slavonic po-koji "rest"). Notion of "period of rest" became in Germanic "period of time."
Now largely superseded by time except in formulaic constructions (e.g. all the while). Middle English sense of "time spent in doing something" now only preserved in worthwhile and phrases such as worth (one's) while. As a conjunction (late Old English), it represents Old English þa hwile þe; form whiles is recorded from early 13c.; whilst is from late 14c., with excrescent -st as in amongst, amidst (see amid).
"to cause (time) to pass without dullness, 1630s, earlier "to occupy or engage (someone or something) for a period of time" (c.1600), new formation from while (n.), not considered to be from Middle English hwulen "to have leisure," which is from a Germanic verb form of while (n.) (cf. German weilen "to stay, linger"). An association with phrases such as Shakespearean beguile the day, Latin diem decipere, French tromper le temps "has led to the substitution of WILE v by some modern writers" [OED] (see wile).