As some already mentioned, you need calories just to exist.
2 slices of pizza ain't going to make you fat if you move around throughout the day (like walking around NYC from apt. to work etc).
Now if you eat a 3/4 of a meat monster pizza and have 3 DIPA bombers on NFL Sunday, well that's a whole mountain of calories that you're most likely not going to burn off that day. You most likely added a spackle of fat...which becomes a less forgiving metabolic burn after 40 due to slowing metabolism.
Bottom line is to eat as much veggies as possible as you can eat a shit ton of it to satiate your appetite and not gain weight (as long as you don't put fattening sauces on it, lol).
Portion control is key to not gaining......unless you're an Olympic swimmer in training.