Zygote is a product of fusion of haploid male gamete and haploid female gamete, i.e. egg cell. Thus, it is diploid.
Male gamete+Egg —--> Zygote (n) + (n) —--> (2 n)
Whereas, primary endosperm cell is a product of fusion of secondary nucleus (2 n) and a haploid male gamete so, it is triploid.
Secondary nucleus+Male gamete .
(2 n) (n)
—--> A Primary endosperm cell