The words him, hymn sound the same but have different meanings and spellings. Why do him, hymn sound the same even though they are completely different words?
The answer is simple: him, hymn are homophones of the English language.
Used as the direct object of a verb: They saw him at the meeting.
Used as the indirect object of a verb: They offered him a ride.
Used as the object of a preposition: This telephone call is for him.
Informal Used as a predicate nominative: It's him. See Usage Note at I1.
A song of praise or thanksgiving to God or a deity.
A song of praise or joy; a paean.
To praise, glorify, or worship in or as if in a hymn.
To sing hymns.
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").