A positive pion is an up and an anti-down. A negative pion is a down and an anti-up. What's a pion with an electrical charge of 0?
Up and anti-up.
Or down and anti-down.
Funny thing is, both of those have the exact same quantum numbers - parity, spin, baryon number and the rest. So a neutral pion can be a mixture of (u + anti-u) and (d + anti-d). There actually result two types of neutral "pion" that decay differently. One is actually heavier, and we call it the eta meson.
Oops I didn't mention yet the strange and anti-strange quark combination, which also gets tangled into the mixes... but it's not important to the neutral pion.
They're made of a combination of up and anti-up, down and anti-down, and strange and anti-strange. And that's just to begin with. To be perfectly accurate you'd have to add all six quarks (okay, maybe not the top).
The short reason is that all these quark combinations have the right quantum numbers and so are included. Feynman diagrams of all sorts contribute, for example:
In the above, the wavy lines are virtual vector bosons. I've put two in because, as Anna V notes, the pion is a psuedoscalar and so has zero spin. Of course the heavy quarks don't appear very much in a light meson since they have to be made from borrowed energy.
People aren't much interested in the heavy quark contribution to the pion. An analogous subject is the heavy quark content of the proton and a reference which will illustrate how this comes about is:
Note that the masses of the nucleons are about 1 GeV while the mass of the t-quark is around 171 GeV.