The word while likes to keep busy. It's entered in the dictionary with four parts of speech.
The first is a noun: take off your coat and stay for a while.
There’s the conjunction, meaning “during the time that”: someone called while you were out.
There is an entry for a preposition, meaning “until.” This usage can be found in Shakespeare (“while then, God be with you”) but is unlikely to turn up in modern English.
The fourth part of speech for while is a verb. Often used with away, it means “to cause to pass especially without boredom or in a pleasant manner”:
Of course, if these activities are of no interest, there's no shame in whiling away the days by the resort's beautiful pool. Just be sure to bring a good book.
— Kimberly Holland, Coastal Living, 26 Sept. 2018A trip to Mykonos town (‘Chora’) is certainly recommended for first time visitors. 180° Sunset Bar is a beautiful spot for cocktails with a view. Or you can just while away the time wandering the pretty streets of Little Venice.
— Lindsay Silberman, Town & Country, 20 Sept. 2018Earlier this year, travelers looking to while away the time at Hartsfield-Jackson International Airport could have browsed for designer brands at Clutch, Luxury Boutique or Sunglass Icon at the center of Concourse F.
— Kelly Yamanouchi, The Atlanta Journal-Constitution, 5 Sept. 2018
While as a verb dates to at least the 17th century, and was preceded by two other senses that fell out of use: a transitive sense meaning “to keep (a person) occupied,” and as part of the phrase while it, meaning “to keep up or endure.”
Perhaps because we aren’t used to seeing words function both as conjunctions and as verbs, while away sometimes gets spelled as wile away:
This isn't to say that "The Nun" has no redeeming value. Anyone who wants to wile away an hour-and-a-half with jump scares and pretty visuals could certainly do much worse, and if nothing else it does provide contemporary culture critics with an interesting insight into the minds of modern moviegoers.
— Matthew Rozsa, Salon, 22 Sept. 2018With its folk-rock score, composed in the key of James Taylor by Schaefer and played by him and the other actors on guitars and a trio of onstage instrumentalists on violin, keyboard and drums, “Light Years” reminds you of any number of nights of easy listenin’ you might have wiled away in a coffee house or bar.
— Peter Marks, Washington Post, 19 Feb. 2018
This usage is common enough to be shown in the dictionary, and in fact has shown use in a number of classic works of literature:
Their only hope was in meeting a ship, although the gale, which had raged all night, had blown them out of their course. To this hope all clung, and wiled away the weary hours, watching the horizon and cheering one another with prophecies of speedy rescue.
— Louisa May Alcott, Jo’s Boys, 1886'To wile away the time till your father comes,' he said,--'pray is there much robbing and murdering of seamen about the water-side now?'
— Charles Dickens, Our Mutual Friend, 1865
The conflation of while with wile might be partly explained by the existence of another verb sense of wile meaning “to lure as if by a magic spell : entice,” which can also be used with away:
Too much must not be expected from the flesh and blood even of John Hiram's bedesmen, and the positive promise of one hundred a year to each of the twelve old men had its way with most of them. The great Bunce was not to be wiled away, and was upheld in his orthodoxy by two adherents.
— Anthony Trollope, The Warden, 1855
One might even make a connection to one’s hours being occupied by the lure of some kind of activity (perhaps different from the one you are supposed to be doing). You might while (or wile) away your hours reading fun and informative articles about language on a dictionary’s website, for example. And really, what would be a more productive use of your time?