Foods that are high in carbohydrates, in particular processed ones, are dangerous when it comes to weight gain as they cause your insulin levels to soar, putting your body into a fat-storing state.
These calories usually end up going straight to fat storage. Not what you want.
Eat carbohydrates in moderation and balance them out with a lean protein.