I want to find a sample path of the following stochastic process:
$$dx(t)=f(x(t))dt+g(x(t))dB(t)$$ where $B$ is the Brownian motion. Let $x_0$ be an initial condition. Can I discrete the process as follows
$$X_{n+1}-X_{n}=f(x(t_n))\Delta T+g(x(t_n))W(t_n)\Delta T$$ where $W(t_n)$ is a Gaussian process. If this method gives an approximate sample path, how can I select the variance of the Gaussian process.
Is there any good numerical solution of the process.
Yes, what you did is generally called the Euler-Maruyama method and has $0.5$ as order of convergence. You can increase that order to 1 by using the Milshtein method which adds a correction term for the deviation of the Brownian motion from a simple random walk $$ X_{n+1}-X_{n}=f(X_n)ΔT+g(X_n)ΔB_n+\frac12 g'(X_n)g(X_n)((ΔB_n)^2-ΔT) $$ where $ΔB_n\sim N(0,ΔT)=N(0,1)\sqrt{ΔT}$.
You can also implement the Milshtein method derivative-free via a two-stage process similar to Heun's method \begin{alignat}{1} K_1&=f(X_n)&ΔT&+g(X_n)&(ΔB_n-S_n\sqrt{ΔT})\\ K_2&=f(X_n+K_1)&ΔT&+g(X_n+K_1)&(ΔB_n+S_n\sqrt{ΔT}) \\[1em]\hline X_{n+1}&=X_n+\frac12(K_1&+K_2) \end{alignat} with additionally $S_n=\pm1$ randomly with probability $0.5$.