The words hostel, hostile sound the same but have different meanings and spellings. Why do hostel, hostile sound the same even though they are completely different words?
The answer is simple: hostel, hostile are homophones of the English language.
A supervised, inexpensive lodging place for travelers, especially young travelers.
An inn; a hotel.
To stay at hostels while traveling.
Of, relating to, or characteristic of an enemy: hostile forces; hostile acts.
Feeling or showing enmity or ill will; antagonistic: a hostile remark.
Unfavorable to health or well-being; inhospitable or adverse: a hostile climate.
An antagonistic person or thing.
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.