The words rap, wrap sound the same but have different meanings and spellings. Why do rap, wrap sound the same even though they are completely different words?
The answer is simple: rap, wrap are homophones of the English language.
To hit sharply and swiftly; strike: rapped the table with his fist.
To utter sharply: rap out a complaint.
To criticize or blame.
To strike a quick light blow: rapped on the door.
To arrange or fold (something) about as cover or protection: She wrapped her fur coat closely about herself.
To cover, envelop, or encase, as by folding or coiling something about: wrapped my head in a scarf.
To enclose, especially in paper, and fasten: wrap a package; wrapped up the peelings.
To clasp, fold, or coil about something: She wrapped her arms about his neck.
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.