In definition of orthogonal matrices we say that the a matrix $A$ is orthogonal if $A^TA = I$, while for Lorentz Group it is written as $\Lambda^Tg\Lambda = g$. And we say that Lorentz transformation forms an orthogonal group

My Question is why do we insert the $g$ in the above definition?

On a vector space $V$ with metric $g$ - be that euclidean, lorentzian or whatever - the Orthogonal group $O(V,g)\subset GL(V)$ is defined to be the group of (linear) isometries on $V$. More precisely, for an element $\Lambda\in O(V,g)$, $$g(\Lambda v,\Lambda u)=g(u,v)$$ holds for all $u,v\in V$. Orthorgonal trafos preserve lengths and angles.

Expanding the above equation in an orthonormal basis $g_{ij}\equiv g(e_i,e_j)$ one finds \begin{align} g(\Lambda u,\Lambda v)&=(\Lambda u)^i\,g_{ij}\,(\Lambda v)^j \\ &=\Lambda^i_{\;k}u^k\,g_{ij}\,\Lambda^j_{\;l}v^l\\ &=(\Lambda^T)_k^{\;i}\,g_{ij}\,\Lambda^j_{\;l}\;u^k v^l\\ &=(\Lambda^Tg\Lambda)_{kl}u^kv^l\\ &\stackrel{!}{=} g(u,v) = g_{kl}\,u^kv^l \end{align} Since this must be true for any $u,v$, the statement follows.

Observe that nowhere in this discussion did we use the particulars of the the metric. The discussion is valid for general $g$. In the euclidean case one has $g_{ij}=\delta_{ij}$, so the relation simplifies to $\Lambda^T\Lambda=I$

$g$ denotes the metric. For Euclidean space the metric is just the unit matrix $I$. For Minkowksi space, which is of interest when talking about the Lorentz group it's the Minkowski metric $\eta_{\mu \nu}$. The lower right matrix inside the Minkowski metric is the 3-dimensional unit matrix and therefore for the space-like components of the Minkowski metric the equation reads $\Lambda^T \eta_{ij} \Lambda = \eta_{ij}$ which is equivalent to $\Lambda^T I \Lambda = I$.