Does $f(g(x))=x$ implies $g(f(x))=x$? Intuitively, it seems right because if $f$ is the inverse of $g$ then $g$ is the inverse of $f$. But I am not sure for its rigorous proof. Please prove or disprove.
If $f$ is a bijective function then is it true? Please prove or disprove.
I will assume both $f$ and $g$ are functions from some set $X$ to itsself, but my answer also applies more generally to when $f:X\to Y$ and $g:Y\to X$ are functions between sets.
To the second part of your question, yes, $f(g(x))=x$ for all $x\in X$ does imply that $g(f(x))=x$ for all $x\in X$ when $f$ is a bijection.
Proof: Let $x\in X$. We are given that $f(g(t))=t$ for all $t\in X$. Applying this to $t=f(x)$, we get $f(\color{blue}{g(f(x))})=f(\color{blue}{x})$. Since $f$ is injective, and $f$ sends both $\color{blue}{blue}$ elements to the same place, they must be the same, so $g(f(x))=x$.
Note that we only needed to add the assumption that $f$ was injective for the proof to work. You can similarly show that $f(g(x))=x$, together with the additional assumption that $g$ is surjective, implies that $g(f(x))=x$.