It commemorates the story of Prophet Ibrahim (Abraham). According to Islamic tradition, Satan (Iblis) tried three times to persuade Ibrahim to disobey God's command. Each time, Ibrahim rejected Satan by throwing small pebbles at him.
The ritual also symbolizes each pilgrim's own rejection of temptation, sin, and evil influences. It is a reminder to resist anything that leads one away from God.