Why do fundamental particles have charge?
The answer on the question from the topic which I have is heuristical and it may not coincide with the answer what you want to get (write, if it doesn't coincide).
We know that particles interact with each other through some interaction law. We also know that apriori we may identify them by such quantities: the $i$-th particle has definite mass, spin etc. We know that for given initial set of particles only definite final sets appear; so that there is some selection rule, which may be interpreted as consequence of conservation law of some quantity. We may parametrize this phenomena by giving to the $i$-th particle number $q_{i}$, so that
$$
\sum_{i}q_{i}^{\text{initial}} = \sum_{j}q_{j}^{\text{final}}
$$
Quantity $q_{i}$ is called charge.
and thus repel objects of similar charge and attract those of opposite
charge
This ability (repel or attract similar charged object) strongly depends on the helicity of mediator of interaction and is promoted by the requirement that the time derivative of spatial components of action, which is just the kinetic term must be with the positive sign (one of implications of the unitarity). Suppose the helicity $s$ boson mediator is described by $A_{\mu_{1}...\mu_{s}}$. Hence the kinetic term in the lagrangian is like
$$
\partial_{0}A_{i_{1}...i_{s}}\partial^{0}A^{i_{1}...i_{s}} = (-1)^{s}(\partial_{0}A_{i_{1}...i_{s}})^{2}
$$
For even helicity, there is plus one factor in the front, while for odd helicity there is minus. We thus need extra minus sign at the front for an odd helicity. Finally, gauge field is present as the propagator when we calculate the energy of interaction of charges. Extra minus sign for odd helicity gauge bosons which comes from the above statement of the unitarity leads to negative sign of interaction energy with $q_{1}q_{2}$, where $q_{1},q_{2}$ are charges. Hence similar charges are repelled for odd helicity mediator.
For the case of electromagnetic field, we have that corresponding gauge boson is helicity one, so EM interaction leads to repelling of similar charges, while even helicity gauge boson (like gravitons) interaction leads to repelling of similar charges (in fact, there can't be gauge bosons with helicity $>2$ since this violates Lorentz invariance).
Also, why would the charge of an electron and proton have the same
magnitude???
From one point of view, the reason is that charge is quantized. In fact, you know that quarks carry electric charges and electron carries it too, but they aren't, naively, related to each other. But in fact the requirement that theory which describes their interaction is unitary leads to the statement that these charges are related to each other by some relations (called anomaly matching conditions). So that, by using these conditions you can calculate the charge of $uud$ quarks bound state, which is a proton. And you surprisingly obtain that it is opposite to the electron charge.
From another point of view, the answer on this question are Ward identities in QED.
Suppose we know apriori that the "bare" charges of electron and proton have the same magnitude. The question: why the proton which is surrounded by clouds of virtual mesons, gluons etc., has the same "physical" charge as the electron, which is surrounded by other virtual particles and doesn't interact as hadron? They come from the quantum requirement of gauge invariance and their result is that quantum corrections from the field renormalization (electron or proton, it doesn't matter) completely reduces quantum corrections from the interaction vertex renormalization (which again depends on the field - electron, proton etc). So that the charge doesn't feel the difference between the nature of the particle which carries it.