The words rack, wrack sound the same but have different meanings and spellings. Why do rack, wrack sound the same even though they are completely different words?
The answer is simple: rack, wrack are homophones of the English language.
To torture by means of the rack.
A cause of intense anguish.
A framework or stand in or on which to hold, hang, or display various articles: a trophy rack; a rack for baseball bats in the dugout; a drying rack for laundry.
Games A triangular frame for arranging billiard or pool balls at the start of a game.
Destruction or ruin.
A remnant or vestige of something destroyed.
Wreckage, especially of a ship cast ashore.
Chiefly British Violent destruction of a building or vehicle.
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").