Aims. We aim to derive the chemical behavior of a significant sample of PNe and HII regions in the irregular galaxy NGC 6822. The selected objects are distributed in different zones of the galaxy. Our purpose is to obtain the chemical abundances of the present interstellar medium (ISM), represented by H ii regions, and the corresponding values at the time of formation of PNe. With these data the chemical homogeneity of NGC 6822 were tested and the abundance pattern given by H ii regions and PNe used as an observational constraint for computing chemical evolution models to infer the chemical history of NGC 6822.Methods. Due to the faintness of PNe and H ii regions in NGC 6822, to gather spectroscopic data with large telescopes is necessary.We obtained a well suited sample of spectra by employing VLT-FORS 2 and Gemini-GMOS spectrographs. Ionic and total abundances were calculated for the objects where electron temperatures could determined through the detection of [O iii] λ4363 or/and [N ii] λ5755 lines. A "simple" chemical evolution model was developed and the observed data were used to compute a model for NGC 6822 in order to infer a preliminary chemical history in this galaxy.Results. Confident determinations of He, O, N, Ne, S and Ar abundances were derived for a sample of 11 PNe and one H ii region. We confirm that the present ISM is chemically homogeneous, at least in the central 2 kpc of the galaxy, showing a value 12 + log O/H = 8.06 ± 0.04. From the abundance pattern of PNe, we identified two populations: a group of young PNe with abundances similar to H ii regions and a group of older objects with abundances a factor of two lower. A pair of extreme Type I PNe were found. No third dredge-up O enrichement was detected in PNe of this galaxy. The abundance determinations allow us to discuss the chemical behavior of the present and past ISM in NGC 6822. Our preliminary chemical evolution model predicts that an important gas-mass loss occurred during the first 5.3 Gyr, that no star higher than 40 M was formed, and that 1% of all 3-15 M stars became binary system progenitors of SNIa.