جَاءَ زَيْدٌ وَأَحْمَدُ — Zayd and Aḥmad came.
زَيْدٌ: nominative subject with tanwīn. أَحْمَدُ: coordinated nominative noun, without tanwīn.
مَرَرْتُ بِزَيْدٍ وَأَحْمَدَ — I passed by Zayd and Aḥmad.
زَيْدٍ: genitive with kasra and tanwīn. أَحْمَدَ: coordinated genitive, marked with fatḥa.
The noun class—not simply the shared proper-name status—explains the different endings.