According to Wiktionary, the Greek word ναι comes from Ancient Greek ναί, which is a variation of νή, which comes from Proto-Indo-European ne, which means no.
Why can a word have the opposite meaning to its origin? Or was Wiktionary wrong here, and this word actually comes from another language?