The grandfather paradox is a famous thought experiment of temporal mechanics. Suppose you could travel back in time and would kill your own grandfather. Your parent would then not be born. You would cease to exist, thus making it impossible to kill your grandfather in the first place.
Another form of this paradox is the "predestination paradox". You travel back in time and fall in love with a woman, who in your own timeline would be your grandmother, and in essence you will become your own grandfather. Doctor Julian Bashir feared this was the case when he met Lieutenant Watley after traveling back to the year 2268. He also worried that if he did not pursue a relationship with Watley, he might not exist when he returned to his own time in the 24th century, as Watley was the name of his great-grandmother. (DS9: "Trials and Tribble-ations")
A resolution to this paradoxical situation is to assume the existence of many timelines. By killing your grandfather in the past, you would create an alternate timeline in which you don't exist, but without changing your own original timeline.
This might be based on the Many-worlds interpretation of quantum mechanics which states that for any event there is an infinite number of outcomes, each of which occurs in a distinct parallel universe. For a given decision, there will be a vast (possibly infinite) number of realities, one for each course of action and its effects. So if you kill your grandfather in one timeline, this will automatically create a separate timeline in which you would remain. Any actions you do from there on would have no effect on the timeline you came from. (TNG: "Parallels")
Another possible solution is the known as the Novikov self-consistency conjecture, which does not require the existence of parallel universes. The conjecture postulates that if an individual were to travel backward in time, his actions have already been done, from the present perspective, which leaves the obvious conclusion that the repercussions of his actions result in the future that he knows of. In other words, regardless of time travel, reality must be self-consistent. While this may contradict experience, in this picture no matter what the traveler does, they cannot change how the timeline is laid out – in other words, fate. For example, the plot of the first Terminator film, in which the attempt by Skynet to kill John Connor's mother leads to Connor's conception.