An ideal $P$ of Lie algebra $L$ is called prime if $[H, K] \subseteq P$ with $H, K$ ideals of $L$ implies $H \subseteq P$ or $K \subseteq P$
How can I prove that an ideal of Lie algebra $gl_n$ is prime by using above definition?
Any hint would be appreciated
One thing to realize is that $\mathfrak{gl}_n$ only has four ideals: $\{0\}$, its center, which is the set of scalar multiples of the identity matrix, $\mathfrak{sl}_n$ and $\mathfrak{gl}_n$ itself.
The last of these four satisfies your definition for trivial reasons (in any Lie algebra $ \mathfrak{g}$ we have that $P = \mathfrak{g}$ satisfies your definition because we have $H \subset P$ AND $K \subset P$ regardless of whether $[H, K] \subset P$ or not).
The other cases we can check one by one. Suppose we want to know if $\{0\}$ is prime. Then the question is if we can find non-zero $H$, $K$ such that $[H, K] = \{0\}$. There are only 6 or so combinations to check so we quickly find that the answer is: yes such $H, K$ exist. Hence $\{0\}$ is not prime.
Now let's see if the center is prime. Are there $H, K$ both not contained in the center so that $[H, K]$ is either the center or zero? Now there are only three combinations to check and we see the answer is no. Hence: the center is prime.
Finally we need to do the same check for $\mathfrak{sl}_2$, again, three checks, I won't spoil the answer.
The question remains WHY are there only 4 ideals? The short version is: it is easy to see that there is a vector space decomposition of $\mathfrak{gl}_n$ into the one dimensional space of scalar multiples of the identity and the $(n^2-1)$-dimensional space $\mathfrak{sl}_n$. We also check that the bracket of an element in the first summand with an element in the second summand is zero so that we get a decomposition of Lie algebras and not just vector spaces. It follows that every ideal $I$ itself decomposes as $I_1 \oplus I_2$ with $I_1$ and ideal in the one dimensional Lie algebra of diagonal matrices and $I_2$ an ideal in $\mathfrak{sl}_n$. This clearly means that $I_1$ is either $\{0\}$ or the full set of diagonal matrices. More interestingly: any ideal $I_2$ of $\mathfrak{sl}_n$ is also either $\{0\}$ or all of $\mathfrak{sl}_n$. The technical term for this fact is that $\mathfrak{sl}_n$ is simple. You can probably find a proof of this somewhere here on MSE.