Sometimes it is useful to ask someone if they did something on purpose(わざと) or if they did it on accident(偶然).
For example,
Sometimes in Baseball the player is hit on accident by the pitcher. Which means the pitcher did not want to hit the player. It was an accident.
However sometimes it looks like the pitcher hit them on purpose. This means that the pitcher wanted to hit them. His purpose was to hit the player.