Why are mean and median not equal for asymmetric distributions? My reasoning is as follows: the p.d.f. is divided by the mean (expected value) into two parts, for which the areas under the p.d.f. curve are equal, hence the probabilities that random variable takes a value less then or equal to the mean are 0.5, which means that that value is also the median (by definition of median).
But textbooks say that the mean and median are equal only if the p.d.f. is symmetrical. Where is my mistake?
 A: There's a related question here:
Does mean = median imply that a unimodal distribution is symmetric?
which you should also read, but your title question of why asymmetry can make mean and median unequal should be addressed in some detail (which is why I don't think of this question as a duplicate of that one), and I am taking the opportunity to make a more intuitive, picture-based discussion of some of the issues raised here. The discussion of the why question comes at the end, after dealing with the mistaken premise in the question and the mistakes in the unnamed textbooks you refer to.

I'm going to flip your post about and deal with what textbooks say first:

But textbooks say that the mean and median are equal only if the p.d.f. is symmetrical.

Some textbooks do say things things like this, but they're wrong. The mean and median of asymmetrical distributions can be equal.
It would in some sense be nearly correct to say it the other way around -- i.e. "if the pdf is symmetrical the mean and median are equal" but that's not quite true in general either, since for some symmetrical distributions, the population mean is undefined.
There's actually one measure of skewness based on the difference between mean and median (sometimes called second Pearson skewness or median skewness), but having zero second Pearson skewness doesn't imply symmetry.
Usually when a distribution is asymmetrical, mean and median are unequal, but we can find as many exceptions as we like. Let's look at one.
In my answer to this question: Does mean=mode imply a symmetric distribution?
I showed the following example:

This is an example where the distribution is plainly not symmetric (there's a different number of modes each side of the main peak, for one thing) but the mean and the median turn out to be exactly equal.
It's very easy to construct discrete examples, but people tend to find continuous examples more interesting, I think.

My reasoning is as follows: the p.d.f. is divided by the mean (expected value) into two parts, for which the areas under the p.d.f. curve are equal,

No, the median divides the pdf into two equal areas. Means in general do not.

hence the probabilities that random variable takes a value less then or equal to the mean are 0.5,

Let's look at an example. Consider a standard exponential distribution (which is moderately skewed to the right). Its median -- the value that divides the area under the pdf into two equal parts occurs at $\ln 2\approx 0.69$ while the mean is at $1$, and has only $1/e \approx 37\%$ of the area to its right.

[It's possibly you may have meant that for a symmetric distribution (let's assume the mean is finite), that the mean will be at the median. This is true but doesn't establish the case that mean=median implies symmetry, and as we saw there are counterexamples to the idea.]

But let me return to your title question... Why:

Why are mean and median not equal for asymmetric distributions?

Let's look at a comparison of sample mean and median [which converts directly to a comparison of population mean and median on a discrete distribution].
 sample:  1    2    3    4    6    9   16   95

 median = 5 

 mean = 17

 proportion of observations > median = 1/2
 proportion of observations > mean = 1/8

So how is it that the mean is higher than almost all of the data? For the median it just looks at how many observations are above or below, but the mean also looks are how far away they are. The further up or down the number is the more it "pulls" the mean. As a result a very skewed distribution, one with a heavy tail on one side but not the other, will pull the mean away from the median toward the long tail, leaving a gap between them. That's why the mean in the exponential distribution above is relatively high, well above the 50% point.
By taking a sequence of heavier right tails, you can in fact move a finite mean above any proportion of the distribution you like (as long as it's less than 100%).
So why isn't it always like this? If it's asymmetric why isn't the mean pulled away from the median -- why can some asymmetries leave the mean equal to the median?
Imagine you have a little bump of probability off to some distance to one side of the median. You have two components of how hard it "pulls" -- one is how far away it is, and one is how much of it there is (how much probability). Twice as far away pulls twice as hard, but so does twice as much probability. So if you place bumps of probability on both sides of the median, you can use the two components together to "balance out" (say using a larger bump of probability a medium distance away on one side and two smaller bumps, one closer and one further away on the other side), and so leave the mean at the median, while having the distribution of probability not being symmetric. In the case of the spiky distribution of my example, my bumps are about seven triangular-shaped bits of probability of different sizes carefully placed to achieve all the different things I wanted it to show (some of the triangles overlap though, which you see showing up as flat sections and parts with varying slopes and so on)
