The words pec, peck sound the same but have different meanings and spellings. Why do pec, peck sound the same even though they are completely different words?
The answer is simple: pec, peck are homophones of the English language.
A pectoral muscle.
The <xref>pectoralis major</xref> <xref>muscle</xref>.
A unit of dry volume or capacity in the US Customary System equal to 8 quarts or approximately 537.6 cubic inches.
A unit of dry volume or capacity in the British Imperial System equal to 8 quarts or approximately 554.8 cubic inches.
A container holding or measuring a peck.
Definitions from The American Heritage® Dictionary of the English Language, 5th Edition., from Wiktionary, Creative Commons Attribution/Share-Alike License. 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").