Neither of the clubs has revealed the financial details but local media estimated it was a 15 million pounds ($19.1 million) deal.
"Manchester United is delighted to confirm the signing of Daniel James from Swansea City, subject to international clearance," the club said on its website on Wednesday.
"The 21-year-old Wales international made his professional debut for Swansea City in February 2018 and his senior Wales debut in November 2018, having previously represented the nation at various youth levels."
The young player stated that his transfer to United was a dream came true saying on the club website that "every kid grows up wanting to play for Manchester United".
"This is one of the best days of my life and a challenge I am really looking forward to," he said after the signing.
"The Premier League is the best league in the world and Manchester United is the perfect place for me to continue to develop as a player."
He made a total of 38 appearances for Swansea across all competitions in the 2018/2019 season, notching five goals and making 10 assists.