Why are $X \sim U(-1,1)$ and $Y=X^2$ dependent? Suppose we have two continuous random variables $X \sim U(-1,1)$ and $Y=X^2$. I don't understand why they are dependent.
$$E[X] = 0$$
$$E[Y] = \int_{-1}^{1} x^2  dx = 2/3$$
$$E[XY] = \int_{-1}^{1} x^3 dx = 0$$
They are independent to me because $E[XY]=E[X]E[Y]$, so why they are dependent?

They are clearly not independent: if you know the value $X$ then this gives you information about the value of $Y$ and indeed allows you to calculate it precisely.
You have correctly said independence means $P(X\le a, Y\le b)=P(X\le a) P(Y\le b)$, so for example consider $a=\frac13$ and $b=\frac 14$.

*

*$X \le \frac 13$, i.e. when $-1 \le X \le \frac13$, has probability $\frac23$

*$Y \le \frac 14$, i.e. when $-\frac12 \le X \le \frac12$, has probability $\frac12$

*$X \le \frac 13, Y \le \frac 14$ together, i.e. when $-\frac12 \le X \le \frac13$, has probability $\frac5{12}$
but $\frac23 \times \frac12 \not=\frac5{12}$ so they are not independent. Try other examples with $-1 < a < 1$ and $0 < b < 1$.
$E[XY] = E[X]E[Y]$ is a condition for zero covariance and so zero correlation, but this on its own does not imply independence. The bottom row of Wikipedia's chart illustrating correaltion has other examples of this; in your question you would get a parabolic U-shaped chart.
