It is always told as a fact without explaining the reason. Why do two objects get charged by rubbing? Why one object get negative charge and other get positive charge?
The effect in which two objects get charged by rubbing and remain charged is called the triboelectric effect,
where the root "tribo" means friction in Greek (The Greek word $\tau\rho\iota\beta\omega$ means 'to rub'). Friction is actually unnecessary: contact is enough in principle.
This effect shouldn't be confused with the (Volta or Galvani) "contact potential" between metals which only exists as long as the two metals remain in contact, and especially not with "contact electrification" which was a name of a scientifically incorrect theory of electricity at the end of the 18th century that attempted to overgeneralize the interpretation of the triboelectric effect. "Electrophorus" was a gadget, first produced by Volta, that used the triboelectric effect.
The cause of the triboelectric effect is adhesion - the atoms on the surface literally form chemical bonds. Materials such as fur are ready to lose electrons and become positively charged while the materials such as ebonite or glass gain electrons and become negatively neutral. To get some idea about which atoms are likely to lose or gain electrons, it's useful to know their electronegativity:
The redder atom, the higher electronegativity, and the more likely it is for the atom to gain electrons and become negatively charged. That's especially true for light halogens (fluorine, chlorine) and oxygen. That's partly why glass - with lots of $SiO_2$ - likes to get negatively charged in the triboelectric effect. Even sulfur (40% of ebonite) has a higher electronegativity than e.g. carbon and hydrogen that are abundant in the fur which is why fur loses electrons and becomes positively charged.
Of course, the actual arrangement of the atoms in the molecules matters, too. So this overview of the periodic table was just an analogy, not a reliable way to find out the results of the triboelectric effect.
Two small facts to add to Lubos's answer:
- Rubbing is useful because once the electron has been transferred from one material to the other, you need to "get away" - and there is a chance that the electron comes back with you as you do so. By rubbing, you actually create a large number of "stick-unstick" events, thus improving the chance that charge transfer will occur.
- The greek word ἤλεκτρον (elektron) means "amber". Amber is an insulator that exhibits good tribo-electric properties, and in 1600 William Gilbert first used the word to describe the phenomenon in his book De Magnete . I think its easy to understand how electron got its name.