An accident is an unfortunate event. By their very nature, accidents are not planned. Rear-ending the car ahead of you, spilling milk, unplanned children — all of these are considered accidents (although those children rarely hear the label).
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."