Why do electric generats when we rub two metals
When one object is rubbed against another, static electricity can be created. This is because the rubbing creates a negative charge that is carried by electrons. The electrons can build up to produce static electricity. For example, when you shuffle your feet across a carpet, you are creating many surface contacts between your feet and the carpet, allowing electrons to transfer to you, thereby building up a static charge on your skin. When you touch another person or an object, you can suddenly discharge the static as an electrical shock.
Similarly, when you rub a balloon on your head it causes opposite static charges to build up both on your hair and the balloon. Consequently, when you pull the balloon slowly away from your head, you can see these two opposite static charges attracting one another and making your hair stand up.