The words knap, nap sound the same but have different meanings and spellings. Why do knap, nap sound the same even though they are completely different words?
The answer is simple: knap, nap are homophones of the English language.
To break or chip (stone) with sharp blows, as in shaping flint or obsidian into tools.
Chiefly British To strike sharply; rap.
Chiefly British To snap at or bite.
A brief sleep, often during the day.
To sleep for a brief period, often during the day; doze.
To be unaware of imminent danger or trouble; be off guard: The civil unrest caught the police napping.
A soft or fuzzy surface on fabric or leather.
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").