The Avengers have had hundreds of heroes join its team in the decades since its inception. Their ranks have ranged from trained killers and billionaire playboy philanthropists to literal gods and cosmic entities. During that time, several X-Men have grown to be a part of the team, though they're normally the A-listers that everyone knows about: Wolverine, Rogue, Beast, and Storm. In addition, B-list X-Men such as Scarlet Witch and Quicksilver joined various Avengers teams, as did Wonder Man and Havok.
And then, you've got the C-listers. Most notably, Roberto da Costa, aka Sunspot.
Created in 1982 by Chris Claremont and Bob McLeod, Roberto was one of the original New Mutants, a teenager gifted with the power of absorbing solar energy to convert into physical strength. After discovering his powers during a fight against racist soccer players, Roberto wound up alongside the other teens who would become his fellow New Mutants: Xi'an Coy Manh (Karma), Rahne Sinclair (Wolfsbane), Danielle Moonstar (then under the code name Psyche) and Sam Guthrie (Cannonball).
Though they were trained by Professor Charles Xavier as students, they soon grew to become superheroes in their own right, and had some pretty bonkers adventures together. For decades, Sunspot was primarily based in the X-corner of the Marvel universe, but not in a super big way. He was involved in events of both the X-Men and Marvel variety, but not really in any substantial fashion. As the X-Men and mutant roster has expanded significantly in the 54 years since they first arrived, it's understandable that anyone not already an X-mainstay would get lost in the shuffle. Sunspot just happened to be one of them.
All of that changed in 2012, thanks to Avengers vs. X-Men. Following the battle between the Earth's Mightiest Heroes and the Children of the Atom over the cosmic power of the Phoenix, Captain America and Iron Man decided to rebuild the main Avengers team from the ground up, a process they dubbed the Avengers Machine. While they wanted veterans on hand -- Thor, Black Widow, Wolverine and Spider-Man, to name a few -- Cap and Iron Man also wanted new blood to fit with their ideals of expanding. Two of those new members happened to be Roberto and Sam, though the two of them were understandably not enthused about joining up with the superhero team they just fought against some months back. (Calling in the middle of their retirement also likely didn't help matters either.) But when Roberto learned Captain America himself was calling to ask them to join, it was too good an offer to turn down.