When the bottom of an Asymptotic giant branch star's convective envelope becomes hot enough for hydrogen burning, the CNO cycle can convert newly dredged-up carbon into nitrogen. Its onset and strength depend on mass, composition and envelope structure; it is not a universal property of all stars at one initial mass.
New to topics? Read the docs here!