Different architectures. The Pentium D is an older CPU based on the flawed Netburst architecture Intel was running with during the early 2000s, where they ramped up the clockspeeds as high as they could at the cost of the processor getting very little done with each clock cycle, running hot, and consuming lots of power.
The Pentium E2140 is based on the newer Core 2 architecture, which gets something like twice the amount of work done per clock cycle compared to the old Pentium D, that's why the E2140 can be faster than the Pentium D while being clocked much lower. If you're looking for a CPU upgrade while keeping your motherboard, you're going to need to post which board you have if you want suggestions. If you're looking to play modern games, you really need a Core 2 Quad at minimum, preferably with the ability to overclock it. Even then, you probably are better off saving up money to move to a newer platform, you're currently working with 10 year old technology, there have been a lot of advances since then, and even the fastest Core 2 Quads are starting to struggle a bit on newer games.