Both words come from the Latin name for the city: Neapolis, which itself came from the Greek “nea” (new) + “polis” (city).
The later Italian pronunciation dropped the final “s”, so it became “Napoli”.
The English name “Naples” came via the Middle French “Napples”, which was derived from “Neapolis” by dropping the “o”.