When a glass rod is rubbed with a silk cloth, electrons move from the glass to the silk. As a result, the glass rod becomes positively charged and the silk cloth becomes negatively charged.

What is happening

Rubbing does not create new charge; it transfers charge between the two materials. The total charge stays conserved, but it gets separated onto different objects.

Simple example

Think of the glass rod as losing a few electrons from its surface. Since it has fewer electrons left than before, it ends up with a net positive charge, while the silk gains those electrons and becomes negative.

In one line

This is a classic example of charging by friction.

TL;DR: glass rod loses electrons to silk, so the rod becomes positive and the silk becomes negative.