An accident is an unfortunate event. By their very nature, accidents are not planned. Rear-ending the car ahead of you, spilling milk, losing your footing on an icy sidewalk — all of these are considered accidents.
You will most often hear people use accident to describe an unfortunate mistake, like swerving into oncoming traffic or making a sloppy calculation. However, an accident could have a positive outcome as well: "The invention of the chocolate chip cookie was a happy accident, occurring when the cook decided to add the chopped chocolate to the batter without melting it first."