Friction results from making of bonds between atoms/molecules of mating surfaces. The force between them is of electromagnetic nature. When we drag the two objects in opposite directions, these bonds are continuously broken and made again with the new atoms/molecules. This bond breaking process releases heat