The number of protons in an atom does not directly determine whether something has a negative or positive charge. The charge of an atom or particle is determined by the balance between the number of protons (which have a positive charge) and the number of electrons (which have a negative charge).
In a neutral atom, the number of protons in the nucleus is equal to the number of electrons surrounding the nucleus. This balance of positive and negative charges cancels out, resulting in a net charge of zero.
However, if an atom gains or loses electrons, it becomes an ion with a net positive or negative charge. When an atom loses electrons, it becomes a positively charged ion, called a cation. This is because the number of protons remains the same, but there are fewer negatively charged electrons to balance the positive charge. Conversely, when an atom gains electrons, it becomes a negatively charged ion, called an anion. In this case, the increased number of negatively charged electrons outweighs the positive charge of the protons.
Therefore, while the number of protons in an atom determines its atomic number and the element it belongs to, it is the balance between protons and electrons that determines the overall charge of the atom or ion.