The apparent east-to-west motion of stars is caused by Earth's west-to-east rotation (counterclockwise when viewed from above the North Pole). This is the same reason the sun rises in the east and sets in the west. The stars themselves don't all move in the same direction - it's an illusion from our rotating perspective.