How many cores does a Mid 2012 Macbook Air have? I checked the specs, and the i5-3427U CPU has 2 cores.

But the Activity Monitor shows 4 little charts for the CPU, so it looks like 4 cores. 

Which is correct? Why does the Activity Monitor have 4 charts?
Your computer has 2 cores, but 4 logical processors. What you are seeing is Intel's hyper-threading technology. This technology puts multiple logical processors on a single core, so that each core can run multiple threads at once.

The difference between this and multiple cores is that hyper-threading only duplicates the parts of the processor which control the current state, not the actual execution unit, but multiple cores duplicate everything. This means that your computer will run like it has four cores only if the threads on each core are using different parts of the execution unit, but if the exact same thing was running on both threads in a single core, it wouldn't be any faster than a two-core system without hyper-threading.