system
Given the following post, respond as if you're commenting on Reddit:
human
What is the physical basis for electric charge?

That is, what is it about protons that attracts electrons and repels other protons and vice-versa? Or is it one of those things where that's just the way it is and nobody knows why yet?
gpt
We can push things a little farther than just to say that's how it is.  There's a deep principle of nature called *U(1) gauge invariance*.  It's a kind of symmetry transformation that the laws of physics have, meaning if apply this transformation, the laws of physics are unchanged.

The details of U(1) gauge invariance are somewhat technical, but it has a huge array of consequences.  These include the existence of electric and magnetic fields, the existence of photons, the fact that photons are massless, the fact that photons have spin 1 (which is why electromagnetic fields have a polarization), conservation of electric charge, and the fact that like charges repel and unlike charges attract.

So probably the deepest answer to your question is that the universe has a U(1) gauge invariance.  Now why does U(1) gauge invariance hold?  That we don't know, but it is remarkable to have one principle explaining so much.