Mander's Carnocycle blog has a post Carlisle, Nicholson and the discovery of electrolysis with a detailed account of the story. I will only give the highlights.
On March 20th, 1800 Volta wrote to Sir Banks, the President of the Royal Society in London, describing the construction of his pile. It was an alternating assemblage of zinc and silver disc pairs separated by pieces of cloth soaked in a conducting liquid. Banks disclosed the contents of the letter to select few acquaintances, among whom was the surgeon Anthony Carlisle, who in turn shared it with William Nicholson. By 30th April 1800, Carlisle and Nicholson completed a pile of their own.
Unlike Volta, who was more preoccupied with describing how his pile electroshocked humans, Carlisle and Nicholson focused on the pile itself. As Nicholson later commented in his paper:
“I cannot here look back without some surprise and observe that … the rapid oxidation of the zinc should constitute no part of his [Volta’s] numerous observations”.
The first clue came on May 1st. Steel wires were attached to the pile, and to assist contact a drop of river water was placed on the uppermost disc. Nicholson recorded:
“Mr. Carlisle observed a disengagement of gas round the touching wire. This gas, though very minute in quantity, evidently seemed to me to have the smell afforded by hydrogen. This, with some other facts, led me to propose to break the circuit by the substitution of a tube of water between two wires.”
The next day, after placing the wires into a water filled tube, Carlisle and Nicholson noticed a stream of hydrogen bubbles rising from the wire attached to the zinc disc, while the wire attached to the silver disc blackened from oxidation. It was intriguing that oxygen, presumably produced together with hydrogen, found its way through the water to the other wire. Nicholson wrote that it “seems to point at some general law of the agency of electricity in chemical operations”.
To investigate the "agency" they switched to electrodes made of platinum, which was known to resist oxidation. This time there were two streams of bubbles, large one coming from the zinc side and small one from the silver side, with no oxidation of the wires. “It was natural to conjecture, that the larger stream was hydrogen, and the smaller oxygen”, Nicholson concluded.