The episode in which Squidward becomes involved with a time machine is “SB-129.”
Squidward enters a time machine while trying to escape SpongeBob and Patrick. His journey takes him into the distant future and then back to a prehistoric version of Bikini Bottom, where he encounters primitive ancestors of SpongeBob and Patrick. He also accidentally breaks the machine’s control lever, sending him into a strange dimension of isolation.
“SB-129” is a Season 1 episode and one of the series’ best-known time-travel stories. The title is the episode’s production-code-style name rather than a descriptive phrase such as “Squidward’s Time Machine.” That unusual title is why it can be harder to remember than the plot.
The episode contains a time-paradox joke: while in the prehistoric past, Squidward demonstrates jellyfishing to primitive characters. When he returns home, SpongeBob and Patrick credit him with inventing the activity. Squidward did not invent the time machine, but “SB-129” is the canonical episode title associated with his time-travel adventure.