Step 1: Put \(x=1, y=1\).
\[
g(1)g(1)=g(1)+g(1)+g(1)-2
\]
\[
[g(1)]^2 = 3g(1)-2
\]
\[
[g(1)]^2-3g(1)+2=0
\Rightarrow (g(1)-1)(g(1)-2)=0
\]
So:
\[
g(1)=1 \ \text{or} \ 2
\]
Step 2: Put \(y=1\) in the given equation.
\[
g(x)g(1)=g(x)+g(1)+g(x)-2
\]
\[
g(x)g(1)=2g(x)+g(1)-2
\]
Step 3: Case 1: If \(g(1)=1\).
\[
g(x)\cdot 1 = 2g(x)+1-2
\Rightarrow g(x)=2g(x)-1
\Rightarrow g(x)=1
\]
This gives constant polynomial \(g(x)=1\).
But then \(g(2)=1\), which contradicts \(g(2)=5\).
So this case is rejected.
Step 4: Hence \(g(1)=2\).
Now substitute:
\[
g(x)\cdot 2 = 2g(x)+2-2
\Rightarrow 2g(x)=2g(x)
\]
This is true for all \(x\). So no contradiction.
Step 5: Put \(x=0, y=0\).
\[
g(0)g(0)=g(0)+g(0)+g(0)-2
\Rightarrow [g(0)]^2=3g(0)-2
\]
So again:
\[
g(0)=1 \ \text{or} \ 2
\]
Step 6: Put \(y=0\).
\[
g(x)g(0)=g(x)+g(0)+g(0)-2
\Rightarrow g(x)g(0)=g(x)+2g(0)-2
\]
If \(g(0)=1\):
\[
g(x)=g(x)+0
\]
True for all \(x\).
If \(g(0)=2\):
\[
2g(x)=g(x)+2
\Rightarrow g(x)=2
\]
Then \(g(2)=2\) contradicts \(5\).
So:
\[
g(0)=1
\]
Step 7: Guess polynomial form and use condition \(g(2)=5\).
A known polynomial solution to this functional equation is:
\[
g(x)=x^2+1
\]
Check:
\[
g(2)=2^2+1=5
\]
Matches given value.
Step 8: Find \(\lim_{x\to 3} g(x)\).
Since polynomial is continuous:
\[
\lim_{x\to 3} g(x)=g(3)=3^2+1=10
\]
Final Answer:
\[
\boxed{10}
\]