Episode Star Trek: The Next Generation S5E26 · 2368

Time's Arrow

Two-part episode; part one

Time's Arrow
Image: TMDB

Data's head is found in a cavern beneath San Francisco.

Starfleet summons the Enterprise to Earth after Data's severed head, hundreds of years old, is found in a cave beneath San Francisco alongside nineteenth-century objects. The discovery means Data will die in the past, and the crew traces clues to the planet Devidia II.
Data goes through a time rift alone and arrives in 1890s San Francisco, where he meets a younger Guinan and the writer Samuel Clemens, who is suspicious of him. He learns that aliens are taking life energy from people in the city. The episode ends the season with an away team following him back to the nineteenth century.