We have simple function: $$Y = X^2$$
Writing $X^2$ as: $X^2 = \underbrace{X+X+X+...+X}_{X \text{ times}}$
We can write above equation as:
$$ Y = \underbrace{X+X+X+...+X}_{X \text{ times}}$$
Differentiating with respect to $X$, we get:
$$ \frac{dY}{dX} = \underbrace{1+1+1+1+........+1}_{X \text{ times}}\\ \frac{dY}{dX} =X $$
Since it is known that result must be: $$\frac{dY}{dX}= 2X$$
I just want to know what is wrong with the above derivation.