Particles and their charges It is always known that electrons and protons have opposite charges but what gives electrons or protons the charges they have? 
 A: There are multiple interpretations of your question and I will try to address some of them:


*

*There is nothing particular about the charges of the electrons and protons. I mean by this bold statement that both "positive electrons" (which are called positron) and negative electrons exist in Nature in the same way that there exist anti-protons as well with a negative charge.
It so happens that in the world we live in, the amount of matter is overwhelmly bigger than the amount of anti-matter and therefore all our chemistry is matter based and not anti-matter based.
Why is there this unbalance between matter and anti-matter...as far as I know, nobody knows but it could be related to the CP violations observed in some cases.


This was an answer to a possible philosophical interpretation of your question about why electrons are negative and protons positive.


*

*Now, another interpretation of your question could be why do electrons have charge -1 in elementary charge units and protons +1, in other words why isn't there particles with fraction of the elementary charge. If that is the question, then there actually exist elementary particles with fraction of the elementary charge which are called quarks. The only problem is that these guys can never be seen individually but only as pairs (pions) or triplets (baryons) and they arrange themselves so that the sum of their charges is always an integer multiple of the elementary charge.

*Another interpretation one can think of is why electrons and protons' charge has the value it has and not another one. The value in itself is related to the coupling constant to the electromagnetic field of these particles. Why are these coupling constant the way they are and not otherwise would however leads us to the anthropic principle and I don't want to go in that direction.
A: Well I can only give so much of an answer to this. 
Protons
Protons are a little different than electrons, but it will end in the same result. Protons are not elementary particles. That is, that are comprised of something smaller, quarks. Quarks come in several different flavors and are thought to have different electric charges. But of course, every proton is comprised of a certain set of quarks so that the total charge of a proton is always equal to +1. Quarks can have  $+ 2/3$, $+ 1/3$, $- 2/3$ or $- 1/3$ charge. So this is where a proton gets it's charge. Now where do quarks get their charge? Let's continue to electrons first...
Electrons
Electrons by themselves are elementary particles. It has been predicted for decades that when an electron is within an orbital of an atom though, new properties emerge. This was actually experimentally discovered very recently (I think the orbiton was discovered as recently as 2012). Within the confines of an atom, electrons have 3 parts: The Holon, The Spinon, and the Orbiton. The Holon is what you're after. It gives the electron it's inherit charge, so that's where it comes from. As for an isolated electron's charge and it's origin, or the Holon's charge origin....Ok here is the answer....
This is basically the same question as "Where does gravity come from?, or "Why does the weak and strong force exist? or even Why can't I go faster than the speed of light! Well, of course, this is no longer a physics question. It has migrated to a philosophical question. Who created the universe and it's laws? Why does electric charge even exist? Why can't our universe be determined by other laws! We will never have an answer for these, unless you believe in God. Then your answer is "God created charge. Quarks, Holons and Electrons were his archangels, and to them he bestowed the power to electrically attract."
