The way I understand it, is that it takes the information from your accumulated trophies, but what if I've beaten inFamous-1 as both evil and good and have both of the relavent trophies for doing so? How does it decide then?
Actually, it looks for savegames from the previous game. When starting a new game with an Infamous save present, you'd have the option to start the game as good or evil, depending on the progress present in the savegames on your machine. So if, for example, you only have a save where you finished as evil, you'll have the option to start Infamous 2 as evil. If you have saves for both endings, you'd have an option to start as good or evil, etc.
You always have the option to start from scratch. Also, there are certain other bonuses for a present save game, for example, you get an energy cores bonuses if you collected enough shards in the previous games.