Every atom has positive protons in its nucleus and negative electrons around it. In a normal material the numbers are equal, so the charges cancel and the material is neutral. The protons are locked inside the nuclei, so the only particles that can move from one material to another are electrons.
When you rub two different insulators together, friction pulls electrons off the surface of one material and they are transferred to the surface of the other. For example, when a polythene rod is rubbed with a cloth, electrons move from the cloth onto the rod. The cloth is left with fewer electrons than before.
An insulator does not conduct, so the electrons that arrive cannot flow away through it. They stay where they were rubbed on, and that is why the rod keeps its charge. A metal rod held in the hand would lose its charge at once, because the electrons could flow away through the metal and your body.