The 21-year-old, who earned an England debut last October, arrives at the Liberty Stadium with Europa League experience and becomes Michael Laudrup's fifth summer signing.
The 21-year-old spent three seasons at Anfield, making 69 appearances and scoring seven goals. Roy Hodgson gave him an England debut in October 2012, against San Marino.
The midfielder thanked Liverpool fans following the confirmation of his exit, adding that he owes the Anfield outfit for his progression over recent seasons.
"Just wanna say thank you to every one of the Liverpool fans for there support! They were first class. And will be truly missed," Shelvey wrote on Twitter. "Will miss the city very much.. And the club! Owe a lot to everyone there! Thank you. Time to start a new chapter in life in Wales. Thank you."
Ahead of Swansea's debut Europa League campaign, the midfielder brings European experience having netted four goals in 10 outings for Liverpool last term.
Shelvey becomes Michael Laudrup's fifth summer signing following the return of Jonathan de Guzman on loan from Villarreal and the permanent arrivals of Jordi Amat, Jose Canas and Alejandro Pozuelo.