The words while, wile sound the same but have different meanings and spellings. Why do while, wile sound the same even though they are completely different words?
The answer is simple: while, wile are homophones of the English language.
A period of time: stay for a while; sang all the while. See Usage Note at awhile.
The time, effort, or trouble taken in doing something: The project wasn't worth my while.
As long as; during the time that: It was lovely while it lasted.
At the same time that; although: While the grandparents love the children, they are strict with them.
A stratagem or trick intended to deceive or ensnare.
A disarming or seductive manner, device, or procedure: the wiles of a skilled negotiator.
To influence or lead by means of wiles; entice.
Definitions from The American Heritage® Dictionary of the English Language, 4th Edition and Wordnik.
Homophones (literally "same sound") are usually defined as words that share the same pronunciation, regardless of how they are spelled.