Electromagnetism
Hans Christian Ørsted's compass needle, Copenhagen, 1820
During a lecture in 1820, Ørsted saw a compass needle near a current-carrying wire swing away from magnetic north. It moved so slightly that the audience did not notice. Accounts differ on whether the demonstration was set up to look for a link between electricity and magnetism, so this is the most arguable "accident" here, but the surprise is well recorded. Ørsted spent months testing it before announcing in July 1820 that an electric current generates a magnetic force. Ampère turned it into a law and Faraday later showed the reverse effect, and every electric motor and generator descends from that twitch of a needle.
More about Electromagnetism