Old English spearca "glowing or fiery particle thrown off," from Proto-Germanic *spark- (source also of Middle Low German sparke, Middle Dutch spranke, not found in other Germanic languages). Electrical sense dates from 1748. Old French esparque is from Germanic.
Slang sense of "a gallant, a showy beau, a roisterer" (c. 1600) is perhaps a figurative use, but also perhaps from cognate Old Norse sparkr "lively." Spark plug first recorded 1902 (sparking plug is from 1899); figurative sense of "one who initiates or is a driving force in some activity" is from 1941.
c. 1200, "to emit sparks," from spark (n.). Meaning "to affect by an electrical spark" is from 1889. Figurative meaning "stimulate, to trigger" first attested 1912. Meaning "to play the gallant, to court" is from the 17c. secondary sense of the noun. Related: Sparked; sparking.