When rubbing your feet on a rug, you accumulate negative electric charge. This results from a process known as the triboelectric effect, where two materials in contact exchange electrons due to differences in their electron affinities. In this case, the rug material tends to attract electrons more strongly than your feet, causing electrons to transfer from your body to the rug. As a result, you become negatively charged while the rug becomes positively charged.