I don't remember if it was ever explained in the game.
Cloud, like the other Sephiroth Clones, was being controlled via the Jenova Cells in him.
In moments where it seems someone is talking to Cloud while he is asleep (such as when they were locked up in Hojo's Lab in Shinra Tower), this was actually Jenova and as theorized by Hojo with the Reunion Theory, Jenova's separated cells would seek out to be reunited going so far as to control the body.
The Reunion Theory is a term in the Compilation of Final Fantasy VII. It is a scientific theory proposed by Professor Hojo positing that Jenova cells, once separated, will seek to reunite and return to the main body, influencing the minds of creatures they have been implanted in to do so.
Source: Reunion Theory
While Cloud's party was chasing after Sephiroth (who was actually Jenova after escaping from Shinra Tower), Cloud actually wasn't chasing anyone. He was being lead to Jenova by the Jenova Cells in his body seeking to return to the main body that had taken the form of Sephiroth.