We can see that C has two regions of electron density around it, which means it has a steric number equal to 2. This implies that it is sp hybridized, therefore has 2 unhybridized p-orbitals with which it can form pi bonds with the oxygen atoms.
On the other hand, each O atom has three regions of electron density around it, which means it is sp2 hybridized. This allows each O atoms to have 1 unhybridized p-orbital with which to form a pi bond.
C's sp hybridized orbitals are shown in yellow and its two unhybridized p-orbitals are shown in blue. O's sp2hybridized orbitals are shown in green, while its remaining unhybridized p-orbital is shown in blue.
So, C uses its two sp hybridized orbitals to form sigma bonds with the two O atoms (each O atom uses an sp2 orbital for this).
Let's say C has its pz and px orbitals left unhybridized. Its px orbital will form a pi bond with the O atom that has its px orbital unhybridized, while its pz orbital will for a pi bond with the other O atom's pz orbital.
A faster way to determine how many pi bonds the molecule has is to know that a double bond is comprised of 1 sigma and 1 pi bond. Since CO2 has 2 double bonds, it will have 2 pi bonds.