Like in all science fiction, writers have to develop imaginative explanations to justify the leap in time. It's usually just a mcguffin to kickstart the story, whether it's slingshotting around the sun or hopping into some spruced up DeLorean or phone booth. It serves as a handy tool to tell thought-provoking "what if" scenarios. Sometimes, it enables a filmmaker to shake-up the continuity of an established universe, as in the Star Trek reboot or the latest X-Men movie. It often just creates head-scratching paradoxes and plot holes.
H.G. Wells popularized the idea with his novel The Time Machine, although it wasn't the first to have time travel as a key plot device. A Christmas Carol by Charles Dickens for example did it brilliantly.
In the right hands, it can be an incredible device, but if it's not properly thought out it can be a crutch that raises too many unanswered questions, or worse, opens up a can of contradictions, eventually imploding under the weight of illogical entanglements.
Still, it's fun to ponder the possibilities.