A short answer, is that to estimate interaction energy (which says if same charges attract or repel), you use propagators. Propagators come from the expression of Lagrangians. Finally, the time derivative part for dynamical freedom degrees in the action must be positive, and this has a consequence on the sign of the Lagrangian.
Choose a metrics $(1,-1,-1,-1)$
For instance, for scalar field (spin-0), we have ($i=1,2,3$ representing the spatial coordinate) the : $$S = \int d^4x ~(\partial_0 \Phi\partial^0 \Phi+\partial_i \Phi\partial^i \Phi)$$
Here, the time derivative part of the action is positive (because $g_{00}=1$), so all is OK.
When we calculate energy interaction for particles wich interact via a spin-0 field, one finds that same charges attract each other.
Now, take a spin-1 Lagrangian (electromagnetism):
$$S \sim \int d^4x ~(\partial_\mu A_\nu - \partial_\nu A_\mu) (\partial^\mu A^\nu - \partial^\nu A^\mu)$$
The dynamical degrees of freedom are (some of) the spatial components $A_i$, so the time derivative of the dynamical degrees of freedom is :
$$S \sim \int d^4x ~\partial_0 A_i \partial^0 A^i$$
Now, there is a problem, because this is negative (because $g_{ii} = -1$), so to have the correct action, you must add a minus sign :
$$S \sim -\int d^4x ~ (\partial_\mu A_\nu - \partial_\nu A_\mu) (\partial^\mu A^\nu - \partial^\nu A^\mu)$$
This sign has a direct consequence on the propagators, and it has a direct consequence on interaction energy, which is calculated from propagators.
This explains while same charges interacting via a spin-0 (or spin-2) field attract, while same charges interacting via a spin-1 field repel.
See Zee (Quantum Field Theory in a nutshell), Chapter 1.5, for a complete discussion.
Best Answer
You are really asking why like repels like and opposites attract at the smallest level.
Physics does not answer ultimate "why" questions, because it is a discipline which describes with mathematical models what is observed in nature. The models differ from maps because they not only fit existing data/measurements but are also predictive of new results of experiments and observations. Then the model can be used to answer why questions by how from one state another state can be predicted or described. The ultimate why is contained into the laws and postulates of the theoretical model, which are a distillation of observations/measurements or necessary to identify the mathematical functions with physical measurements .
In electromagnetism it was observations of how matter could be charged and of how charges interacted that developed into the law of Coulomb. This means that the existence of opposite charges assigned to particles is a given of nature, a law.
This was the classical macroscopic observation that is implicit in the laws and postulates of electromagnetism, i.e. the physics axioms that pick out from the infinity of mathematical solutions of the differential equations of the mathematical model those that describe nature and can predict new observations.
Once the microcosm started being explored classical mechanics and classical electrodynamics became inadequate to describe and predict behaviors. Quantum mechanics and special relativity were necessary to describe mathematically and predict results.
The laws of the classical regime are also laws of the quantum mechanical regime or can be seen to emerge from them. This is necessary because there should be a smooth continuity in the predictions of the solutions of the models in phase spaces where both views could be used to calculate and predict charged particle behaviors.
So the answer to your question of of "What causes like to repel like and opposites to attract at the smallest level" , i.e is because that is what measurements and observations say. The "how" is given by the corresponding mathematical theory of quantum electrodynamics
Thus the "how" can be described mathematically, given the axiom that charges exist and like repels like and opposites attract.