The problem is, you do not understand that evaluating the PDF is NOT the same thing as sampling random numbers from that distribution. This is frequently misunderstod. And yes, the PDF tends to look a lot like the samples you would generate.
fitdist applies to a sample from that ditribution. It is NOT used to fit to values generated from the PDF itself though. (A course in probability and statistics would help, or do some reading.)
But here is an example. I'll use a large sample, so the plot will look good.
X = lognrnd(0,1,10000,1);
And that sampling of numbers does look like the PDF itself. Now use fitdist.
D = fitdist(X,'lognormal')
And we see a lognormal distribution has been estimated. The parameters are pretty close to what we used to create the sample, but with a sample size of 10000 points, that is to be expected.
Again, some reading would be of use to you. Spend some time understanding what a PDF is, what is the CDF, and how do you generate a random sampling from them, using tools like lognrnd, as well as how you can use tools like fitdist.