Origin of lepton/quark generations? What theoretical explanations exist for the fact that there are three generations of leptons and quarks?
I'm not so much asking why there are exactly 3 generations, but rather what makes electron, muon and tau differ. Also, since the three families of quarks don't have to be a priori related to the three families of leptons, I'm interested in answers for either quarks, leptons, or both.
 A: here is another argument (disclaimer: I'm an experimentalist):
e.g. Wikipedia states that:

"Direct" CP violation is allowed in the Standard Model if a complex phase appears in the CKM matrix describing quark mixing, or the PMNS matrix describing neutrino mixing. In such a scheme, a necessary condition for the appearance of the complex phase, and thus for CP violation, is the presence of at least three generations of quarks.

the same article also says further down:

The universe is made chiefly of matter, rather than consisting of equal parts of matter and antimatter as might be expected. It can be demonstrated that, to create an imbalance in matter and antimatter from an initial condition of balance, the Sakharov conditions must be satisfied, one of which is the existence of CP violation during the extreme conditions of the first seconds after the Big Bang. Explanations which do not involve CP violation are less plausible, since they rely on the assumption that the matter–antimatter imbalance was present at the beginning, or on other admittedly exotic assumptions.
The Big Bang should have produced equal amounts of matter and antimatter if CP-symmetry was preserved; as such, there should have been total cancellation of both—protons should have cancelled with antiprotons, electrons with positrons, neutrons with antineutrons, and so on. This would have resulted in a sea of radiation in the universe with no matter. 

In other words, if there were less than three generations of quarks (unless the initial state of the universe had a matter/anti-matter asymmetry), there would be no matter and we ultimately wouldn't be able to discuss this topic here...
A: Here is an experimentalist's answer:
The Standard Model of particle physics is not a theoretical invention, it is a laboriously built up compilation of the quantum number behavior in interactions of elementary particles. So it is an experimental fact. 
It first started with SU(2) groups and one found that the symmetries fitted the baryon nomenclature for proton and neutron in nuclear physics to start with, allowing for theoretical potential models to be built up for the nuclear force.
Then came the high energy experiments in accelerators that gave a plethora of particles with well recorded quantum numbers organized by  theorists in assuming SU(3)xSU(2)xU(1) symmetry for the groups describing all the symmetries of the particles and the way they interacted with each other. Again, these are data measured, describing Nature.
These group symmetries do not have separate masses for each particle. In the structure they could all have zero mass. So theories came up which proposed that there is symmetry breaking down in the low energies and if one goes to high enough energies everything is massless. Theories evolved to describe the symmetries and explain the data.
An example are Grand Unified Theories:

A GUT model basically consists of a gauge group which is a compact Lie group, a connection form for that Lie group, a Yang-Mills action for that connection given by an invariant symmetric bilinear form over its Lie algebra (which is specified by a coupling constant for each factor), a Higgs sector consisting of a number of scalar fields taking on values within real/complex representations of the Lie group and chiral Weyl fermions taking on values within a complex rep of the Lie group. The Lie group contains the Standard Model group and the Higgs fields acquire VEVs leading to a spontaneous symmetry breaking to the Standard Model. The Weyl fermions represent matter.

Recent theories that embed the Standard Model and the workings of GUT are String Theories.
So the three generations come from quantum number classifications of data and the theories explaining the observations have  spontaneous symmetry breaking at low energies, and   the the masses differentiate between generations by the mediation of the Higgs field.
A: We don't have a good explanation for why the quarks and leptons fall into generations.  But we have some very strong arguments that it has to be this way, because of the way the weak interactions behave.
First, the weak interactions tell us that each lepton should be paired with a neutrino, and that each charge 2/3 quark should be paired with a charge -1/3 quark.  This pairing is necessary just to write down the Lagrangian for the weak interactions.
The second bit is even weirder.  The weak interactions are chiral; they don't treat left-handed particles in the same way that they treat right-handed particles.  Quantum chiral gauge theories, like the SU(2) x U(1) gauge theory describing the electroweak interactions, are somewhat delicate beasts.  Most classical chiral gauge theories can not be quantized; quantum mechanical effects give rise to anomalous gauge symmetry breaking, which ruin the consistency of the theory.    
In the case of the Glashow-Weinberg-Salam model, there's a consistency condition for avoiding anomalies:  3 times the sum of the charges in a quark doublet + the sum of the charges in a lepton doublet must equal zero.  This condition is satisfied by the Standard Model particles:  3(2/3 - 1/3) + (0 - 1) = 0.  Which tells us that the quark and lepton doublets in a generation really are paired in a non-trivial way.  If they weren't paired up, the theory would most likely be inconsistent.
A: I can think some speculative or unorthodox answers, and sure others can do, so please allow me to mark this answer as Community Wiki:

*

*three generations make a nice number of degrees of freedom for a GUT model.  Assuming that the neutrinos have companions of the other chirality, one generation has 36 degrees of freedom. With this, the MSSM happens to have 128+128 degrees of freedom, and any more minimal SUSY model should still have at least 126+126, because the massive supermultiplets for Z (and W+, W-) contain one scalar partner. Thus 96 squarks and sleptons plus 8 gluons (x2 states) plus Z W W electroweak bosons (x 3) plus photon (x 2) plus three scalars = 96+16+9+2+3= 126.


*Hand waving arguments with octonions have been always around, and according an answer of Joel in the duplicated question, they could have been already in 1966! Modern work along this line has been done by Cohl Furey http://arxiv.org/abs/1405.4601


*Nicolai continuation http://arxiv.org/abs/1412.1715 of a model of Gell-mann involvess two tecniques to fix the number of generations: representations of SO(8) and a colour-flavour locking.


*Frampton suggests anomaly cancelation in a 331 model http://arxiv.org/abs/1504.05877
