Information from the books, as presented on A Wiki of Ice and Fire:
At the age of fifteen, Jaime participated in the campaign against the
Kingswood Brotherhood, during which he saved Lord Sumner Crakehall
from Big Belly Ben and crossed swords with the psychotic Smiling
Knight. After the brotherhood had been defeated, Jaime was knighted on
the battlefield by Ser Arthur Dayne, a member of the Kingsguard of
King Aerys II Targaryen.
Now a knight, Jaime was to return to Casterly Rock. He decided to stop
in King's Landing on route, to visit his sister, from whom he had been
separated for years. There, Cersei informed him that Lord Tywin
intended to betroth him to Lysa Tully, and had gone as far as inviting
Lord Hoster to King's Landing, to discuss the dower. Cersei suggested
that Jaime become a member of the Kingsguard instead, replacing the
recently deceased Ser Harlan Grandison. Though this would require
Jaime to give up his claim to Casterly Rock and his position as Lord
Tywin's heir, it would allow him to be close to Cersei and free
himself of the unwanted marriage to Lysa. After a night of passionate
sex, he gave his consent to Cersei's plan. While the siblings expected
Tywin to oppose it, Cersei claimed he could not openly object. She
promised to do the rest, and a month later, Jaime received news at
Casterly Rock that he had been chosen for the Kingsguard, and was to
present himself to the king at Harrenhal during the grand Tourney,
where he would say his vows and don his cloak. Jaime's and
Cersei's plan did not entirely work as expected. Their father, furious
about the King's decision, pleaded illness and resigned his position
as Hand of the King. He returned to Casterly Rock, taking Cersei with
him, which separated the siblings once more.
King Aerys II Targaryen went along with the plan for reasons of his own:
Jaime was raised to the Kingsguard by Lord Commander Ser Gerold
Hightower in a ceremony during the tourney at Harrenhal in 281 AC,
making him the youngest knight ever to be raised to the
order. That night, however, King Aerys II Targaryen soured
the honor by sending him back to King's Landing to guard Queen Rhaella
and Prince Viserys, depriving Jaime of the chance to participate in
Lord Walter Whent's tourney. It was that moment during which Jaime
realized that the king had only chosen him for the Kingsguard to
slight Lord Tywin, of whom Aerys was insanely jealous, and to rob him
of his heir.
However, after his sister married Robert Baratheon their plan did succeed:
Jaime was part of the honor guard that brought Cersei to King's
Landing for her wedding to Robert. Cersei and Robert were married in
284 AC, with Jaime present. He won the tourney held to
celebrate the wedding. Jaime and Cersei had sex on the morning of
Cersei's wedding, and continued their illicit relationship after
Cersei's wedding. Cersei refused to join her new husband on his
hunting trips, as to be able to spend time with Jaime. Jaime
accompanied Robert and Cersei to Greenstone, when Robert went to visit
his mother's family. Jaime dubbed the castle "Greenshit" when he first
saw it, and convinced Cersei to do the same. They spent a fortnight
with the Estermonts. During one of those nights, Jaime followed Robert
on Cersei's request, to confirm her suspicion that Robert was sleeping
with his cousin. Jaime and Cersei slept together that night, and
Cersei likes to believe that their eldest son, Joffrey, was conceived
that night.
An important note WRT the Kingsguard:
They are sworn for life