(covers information from several alternate timelines)
A generational ship is a starship in which, over an extended period of time, the operations of the ship are passed down to the crew's descendants. They are typically used by races who do not have access to warp drive technology for lengthy travel across space.
Around the 20th century, the Kelvan Empire - having discovered that rising radiation levels would render their native Andromeda Galaxy uninhabitable within 10,000 millenia - dispatched multi-generational starships to their neighboring galaxies, searching for new territories suitable for conquest and occupation. One such expedition arrived in the Milky Way Galaxy in 2268, where it encounter the USS Enterprise. (TOS: "By Any Other Name")
In an alternate timeline in which the Enterprise NX-01 was thrown back in time 117 years from 2154, Enterprise became a generational ship, the crew showing their children how to operate and maintain ship's systems, a process which was repeated for the next generation. Eventually, the crew was able to change history by intercepting their counterparts in 2154, and assisting them in making modifications which prevented the time travel event from occurring. (ENT: "E²")
In 2375, the crew of the USS Voyager encountered a Varro generational ship in the Delta Quadrant, which had been in continuous operation for 400 years. Assisting the Varro crew in making repairs, they eventually uncovered an underground movement aboard the generational vessel aimed towards breaking away from the rest of the community and exploring the galaxy. (VOY: "The Disease")