Is it possible to put a 5.0 engine inside of a 2.4? Not sure if it would even fit, the 2.4 barely fits lol.
Anything is possible if one is willing to invest enough dollars and engineering !
That said, I doubt it can be done without extreme difficulty. The G6 is on the Epsilon platform, which is slightly narrower than a w-body, which can handle the 5.3L LS4. But it barely fits into those, with almost no clearance between the end of the motor and the passenger side shock tower. (I have an 07 Impala SS, FWIW.) The engineers at GM made several mods to that motor in order to get it to fit in the w-bodies.
So trying to squeeze such a beast into the G6 is not really a project most folks would take on.
In my case, if I ever build a hot rod, I'll start with a rear-wheel drive platform that can already handle a V8, then go from there.
Trying to do any more than just squeezing a little extra out of a G6 requires a commitment that ain't worth the effort, IMO.