The words desert, dessert sound the same but have different meanings and spellings. Why do desert, dessert sound the same even though they are completely different words?
The answer is simple: desert, dessert are homophones of the English language.
A barren or desolate area, especially:
A dry, often sandy region of little rainfall, extreme temperatures, and sparse vegetation.
A region of permanent cold that is largely or entirely devoid of life.
An apparently lifeless area of water.
A usually sweet course or dish, as of fruit, ice cream, or pastry, served at the end of a meal.
Chiefly British Fresh fruit, nuts, or sweetmeats served after the sweet course of a dinner.
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.
If they are spelled the same then they are also homographs (and homonyms); if they are spelled differently then they are also heterographs (literally "different writing").