Among these differential equations why one is linear while other is non-linear?

What is criteria to find out whether a differential equation is linear or non-linear?
On
Linear differential equations: They do not contain any powers of the unknown function or its derivatives (apart from 1). Your first equation falls under this. If this equation had something like $\frac{dy}{dx}^n$, $\frac{d^2y}{dx^2}^n$ where $n \neq 0 \ \text{or}\ 1$, this would make it non-linear.
Non-linear: may contain any powers of the unknown function or its derivatives (where power $> 0$) or even a product of unknown function and its derivatives. Your second equation is non-linear because it contains a power of the unknown function (in this case, $y(x)^2$)
The distinction is important because linear differential equations are generally easier to solve than non-linear equations.
A differential equation is linear if there are no products of $y$ and its differentials.
For example, $y\cdot \frac{dy}{dx}=e^x$ would be non-linear, as well as $y^2+\frac{dy}{dx}=e^x$.