My question is very simple and short.
Orthogonality Condition: If two functions $f,g$ are orthogonal then $$\displaystyle\int_a^b f(x)g(x)dx=0$$
Question: How we decide $a$ and $b$ what should they be? Or in the definition of orthogonality do we even need interval for integral?(can just indefinite form of the integral satisfy orthogonality?)
If not, then, can we define $a,b$ so that $f,g$ are sometimes orthogonal and sometimes not?
Orthogonality is tied to the inner product you have on your vector space. Indeed, two vectors are said orthogonal if their inner product is $0$.
That being said, what you have here is an inner product. So the choice of $a,b$ depends on the function space you are considering. For example if you want to study an innner product on continuous functions on $[0,1]$, then you must have $a=0$ and $b=1$.
Indeed, considering $a<0$ or $b>1$ makes no sense, because functions are not defined there. If you chose $0<a<b<1$, then it is easy to find a continuous functions satisfying $\int_a^b f(x)^2dx=0$ while $f$ is different from the null function on $[0,1]$. Hence $\int_a^b fg$ fails to be an inner product on the space of continuous functions on $[0,1]$.