All elements are found as particles called atoms, composed to protons, neutrons and electrons, the exception being hydrogen which does not have neutrons. The protons and neutrons form the nucleus around which the electrons orbit.
Carbon has an atomic number 6 and nitrogen has an atomic number 7. Each atom of carbon has 6 protons, six neutrons and 6 protons. Each atom of nitrogen has 7 protons, 7 electrons and 7 neutrons. The atomic mass of carbon and nitrogen is 12 and 14 respectively.
As the number of electrons in the atoms of the two elements is different they have different chemical properties. The elements that each of the two reacts with and the chemical compounds formed as a result of the reactions are also different.