I tried to prove by contradiction.
If possible, let $(X,\tau)$ be disconnected.
Then $\exists$ non-empty open sets $A,B$ such that $A\cap B=\phi$ and $A \cup B=X $.
This would mean $A^c=B,B^c=A$, so $A,B$ are countable.
Then $A\cup B$ is countable, but $X$ is infinite, which is a contradiction.
So it must be connected.
Is this proof correct?
An $(X, \tau)$ defined in that way is not always connected. A simple counterexample is $ X = \mathbb{N}$: let $A$ be the set of even number and $B$ the set of odd number. Then $A\cap B= \emptyset$, $A\cup B = \mathbb{N}$ and $A$ and $B$ are both open.
However the proposition is true if you ask not only that $X$ is infinite, but also that $X$ is uncountable, you can try to prove that.