For more information about the 1st Dimension, check out the regular Phineas and Ferb Wiki
It's been five years since Phineas and Ferb adopted their pet platypus, Perry from the O.W.C.A.'s animal shelter. To celebrate, they and their friends play giant platypus badminton. Phineas and Ferb are launched off of a giant platy-pult in a shuttlecock, and end up crashing on the roof of Doofenshmirtz Evil Incorporated, destroying the latest invention of Dr. Doofenshmirtz, the Other Dimension-inator.
Feeling sorry for him, and not knowing that he is evil, the boys help him rebuild it, and they successfully create a portal to the 2nd Dimension. There, they discover that the 2nd Dimension's Tri-State Area is ruled by a much more evil and sinister Doofenshmirtz. The boys meet their alternate selves, find out that Perry is a secret agent, and team up with a group of civilians dubbed The Resistance to end Doofenshmirtz-2's reign and save the world.