History in the Books
Viserion is first presented to Daenerys alongside his brothers Drogon and Rhaegal as eggs. He later hatches when placed on the funeral pyre of Daenerys' husband, Khal Drogo (Drogon's namesake). When Daenerys tried to immolate herself with Khal Drogo, and sacrificed the witch who had left Khal Drogo in a permanent comatose state, the resulting sacrifice of life for life resulted in Viserion and his brothers hatching, with Daenerys being unharmed by the flames.
As Viserion grew, he was trained by Daenerys, who learned much of dragons by raising him and his brothers. During her time in the city of Qarth, when the Sorcerers known as the Undying steal Rhaegal and Viserion, Daeneys and Drogon go to rescue them.
Viserion soon reaches the size of a small dog by the third novel. At Slaver's Bay, Irri, one of Daenerys' handmaidens, frees Viserion to attack the slavers when Daenerys Targaryen has the Unsullied attack their former masters.
During her time in Meereen, Viserion, like his brothers, starts to grow untamable and dangerous and Daenerys chains him and Rhaegal up after Drogon supposedly kills a young girl. When Daenerys takes Prince Quentyn Martell to see her dragons she notices that Viserion has shattered one chain and melted the others. After Daenerys disappears on Drogon's back, Prince Quentyn attempts to steal a dragon after enlisting the help of the Windblown. Quentyn realizes that Viserion is in the process of making a cave big enough to sleep in. Viserion appears and is first attracted to a woman named Pretty Meris, as he is looking for Daenerys. Quentyn tries to tame him, but a crossbowman of the Brazen Beasts fires a quarrel at Viserion and is then killed by the dragon. Quentyn then attempts to dominate Viserion with a whip. Unbeknownst to Quentyn, however, Rhaegal sneaks up behind him and green dragon looses his fire, fatally burning Quentyn.
In the aftermath the iron doors are left open and the two dragons escape their imprisonment. Viserion then makes his lair in the pyramid of Uhlez. Sometime thereafter, while on the terrace of the Great Pyramid, Ser Barristan spies pale wings moving above a distant line of eastern hills beyond the city walls.
As the Second Siege of Meereen commences, Viserion and his brother are drawn to the smell of blood and carnage. Viserion flies above the battle being fought beneath in the city.
After donning his armour, Tyrion Lannister steps out of his tent and sees some of the Second Sons gawking at the white dragon above. The Wicked Sister sends corpses through the sky and some burst into flame as Viserion seeks to devour them. Some of the flaming corpses fall to the ground, causing Yunkish horsemen to catch fire, spreading terror and panic. By the time Ben Plumm comes back from his meeting with Malazza, the Girl General, Viserion has flown back to his lair atop the pyramid of Uhlez. His further fate is unknown.
History in the TV Series
Viserion's history is much the same in the television series as in the books, but he is shown to be far more loyal to Daenerys than in the books, and has grown faster and larger than in the books, though not as big as Drogon and slightly smaller than Rhaegal.
Viserion is again presented as an egg by Khal Drogo as his wedding present to Daenerys alongside Drogon and Rhaegal's eggs. However, Viserys Targaryen, Daenerys' older, mentally unstable brother and Viserion's namesake, tried stealing the eggs, only to be stopped by Ser Jorah Mormont. He hatches in the same way as in the books, placed on the funeral pyre of the dead Khal Drogo, with Daenerys walking into the flames to immolate herself, causing him and his brothers to hatch.
During their time in Qarth, it is Pyat Pree that steals the dragons and places them in the House of the Undying, taking all three instead of just Rhaegal and Viserion as seen in the novels, before luring Daenerys to them to keep his magic strong, as his magic is empowered by the dragons' magic and that they are strongest in her presence. When she is chained up with her dragons, Daenerys unconcernedly whispers "Dracarys", signaling her dragons to breathe fire, and they burn Pyat Pree to death before incinerating the House of the Undying.
Viserion, along with his brothers, accompanies Daenerys on her journey from Astapor and Yunkai. When Daenerys has a meeting with a Razdal mo Eraz, of the Wise Masters of Yunkai, Rhaegal hisses at the slaver along with his brother Drogon when he comes too close to Daenerys. He then fights over a piece of meat with his brothers when Daenerys makes a show of force to intimidate Razdal. After Daenerys frees the slaves of Yunkai, Viserion takes to the sky with his siblings at Daenerys's command; a show of both power and freedom to the newly liberated people.
Viserion is seen with his brother Viserion fighting over a dead sheep they have killed. Drogon, who is now visibly bigger than them, quickly takes the lamb as his brothers squeal for him to share. He sets the corpse down and the three begin to eat. In response to Drogon's killing of a three-year-old girl, Daenerys leads Viserion and Rhaegal into the catacombs of Meereen, where she chains them up, much to her pain.
After some time, Daenerys finally decides to reenter the catacombs to attempt to regain control over her dragons. Viserion and Rhaegal, who have grown even larger during their time in captivity, now around as large as orcas, immediately lash out and breathe fire in anger at the sight of their mother who imprisoned them. Later, Daenerys, reeling over the death of Ser Barristan Selmy, the leader of her Queensguard, arrests the leaders of Meereen's great families and brings them to meet Rhaegal and Viserion. Rhaegal roasts one of nobles and begins to eat, sharing the meal with Viserion. Her point proven, Daenerys leaves, sarcastically saying that she doesn't want to overfeed the dragons.
In the Great Pyramid, Tyrion Lannister learns that Viserion and Rhaegal have not been eating anything ever since their mother had left. He then decides to free them, knowing that they will be better off that way and knowing they may die otherwise. Accompanied to the entranceway by Varys, Tyrion ventures alone into the catacombs and encounters Rhaegal and Viserion for the first time. By this time, they are now around 60 feet long and are evermore fearsome in appearance. Despite their initial hostility towards him, Tyrion remains calm, assuring them he is a friend of Daenerys and only wants to help them. He manages to earn their trust and unshackle them while telling them the story of how he wanted a dragon for his nameday, only to be disappointed by uproarious laughter from his family and the cold truth from his father. Once free, the dragons immediately depart into the darkness of the catacombs while Tyrion quickly exits with Varys, asking the latter to punch him in the face the next time he decided to try something that stupid again.
After Daenerys returns to Meereen and pits Drogon against the fleet assembled by Astapor, Yunkai, and Volantis, Rhaegal and Viserion break out of the catacombs and join their mother and brother in destroying the the slavers' fleet with dragon fire, decisively breaking the Second Siege of Meereen. This defeat marks the end attempt to reintroduce slavery to Meereen and allows Daenerys to take the enemy fleet for her own.
Some time later, Viserion and his brothers accompany their mother and her large army on a voyage to retake Westeros by soaring above the armada.