The 21-year-old came through United's youth ranks before making 55 appearances across all competitions for the club. Elanga has been capped 12 times for Sweden.
The two clubs are reported to have agreed a deal worth £15 million ($19.27m).
"It's a pleasure to be here. It's a proud moment, not only for me, but for my family as well," Elanga said in a statement.
"It's the perfect next step for me in my career... I had interest from elsewhere, but for me, Nottingham Forest feels like the perfect place."
Elanga scored four goals in all competitions for United since making his debut in the 2020-21 season.
"Anthony has been a fine role model and example for other members of the Academy, and leaves with our sincere best wishes for the future, after Forest won the race for his signature," United said.
"We would like to thank him for his service at United."