The 19-year-old - who passed his medical on Friday - will sign a three-and-a-half-year contract when the transfer window officially opens on January 1 with the fee while undisclosed being more than the original £100,000 (119 euros) they offered earlier.
Donnelly's transfer fee rose after both Liverpool and their city rivals Everton declared an interest in the striker, who has scored 17 times this term for the Northern Irish club.
"We are delighted to be able to attract one of Northern Ireland's biggest talents," said Swansea manager Brendan Rodgers.
"I am really looking forward to helping Rory fulfil his potential and, hopefully, over the next few years ensure that Swansea City has another exciting young player blossoming at the club," added the 38-year-old.
Donnelly, who was called up for the first time to the Northern Ireland Under-21 squad in November but has yet to play for them, said that it was the rapport he struck up with compatriot Rodgers that convinced him to join.
"Everything has happened so quickly that I still can't quite believe it. It's a dream come true," said Donnelly.
"I was really impressed with what the manager had to say when I met him. He couldn't have done anything more to impress me.
"I believe I am signing for a brilliant manager who is prepared to give youth a chance.
"I also met the likes of Scott Sinclair and Joe Allen when I was over here last week and it only reinforced the belief that Swansea is the right club for me.
"I know there was serious interest from Everton and Liverpool, but I love the way Swansea play the game and I think it will suit me.
"The manager has told me there is no pressure on me because I am only 19. In time there will be pressure, but not right now.
"He has shown a lot of faith in me and, hopefully, in time I can repay him with plenty of goals."
Swansea are presently 14th in the Premier League, but only five points above the relegation places.
Swansea beat off Liverpool to sign teenage star
Advertisement