Why is 2...e6 the most common move after 1 d4 Nf6 2 c4, but not after 1 d4 Nf6 2 Nf3? This is the case on the Chesstempo database, and the Chessbase database.

I don't understand why. Wouldn't people who favour Nimzo-type setups play 2...e6 against both moves, and people who favour King's Indian setups play 2...g6 against both? If so, why is 2...g6 more popular than 2...e6 in the position 1 d4 Nf6 2 Nf3?
I believe the reason is that from a theoretical point of view it makes a lot of sense to go for the Queen's Gambit declined, only after white has played Nf3. The most aggressive tries for white in the QGD involve Nge2 and f3, aiming for e4, a plan that was introduced by Botvinnik and is still very dangerous. Obviously this isn't possible if white has already played Nf3.

Also if white goes for d4/c4/Nc3 it makes sense to go for the Nimzo-Indian because the Nimzo is theoretically in excellent shape. Whereas the Queen's Indian at least right now is apparently under some pressure. 

I would further argue that the Queen's Indian or the Bogo-Indian aren't closer in terms of "set up" to the Nimzo then the QGD. There is actually a very trendy line right now, that can be reached from both the Nimzo and the QGD: The Ragozin variation.

So this isn't a case of Nimzo-setup against King's Indian-setup, it is just the case that the theoretically soundest repertoire for black against d4 is a combination of Nimzo and QGD. With that in mind the statistics make sense: Basically you go for the QGD whenever Nf3 happens, otherwise you keep the Nimzo option open.