The words knit, nit sound the same but have different meanings and spellings. Why do knit, nit sound the same even though they are completely different words?
The answer is simple: knit, nit are homophones of the English language.
To make (a fabric or garment) by intertwining yarn or thread in a series of connected loops either by hand, with knitting needles, or on a machine.
To form (yarn or thread) into fabric by intertwining.
To join closely; unite securely.
To draw (the brows) together in wrinkles; furrow.
The egg or young of a parasitic insect, such as a louse.
A unit of illuminative brightness equal to one candle per square meter, measured perpendicular to the rays of the source.
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").