Why do polyatomic ions have a charge?
The same reason monatomic ions have a charge - due to an imbalance between the number of protons and electrons.
Polyatomic ions are composed of two or more covalently bonded atoms - similar to that of a neutral molecule. However, as the name implies, this group of covalently bonded atoms has a difference in the number of electrons v protons. So in the formation of the cyanide ion, for example, CN-, carbon and nitrogen bond together through the formation of a carbon-nitrogen triple bond.
However, if we draw the appropriate structure, you will see that in order for the carbon and nitrogen to achieve stable electron configurations, they will need one more electron than the two of them have collectively - so they obtain an additional electron from a metal donor.
This video may help: