Could you tell me where is mistake in my proof?
Suppose that exist finite basis ${e_{1},\dots ,e_{N}}$. Then $q(x)=a_{1}e_{1}+\dots +a_{N}e_{N}$ where $q(x) = q$ for every $x$, where $q$ is number. Take some $f$ from $C(X)$ then $$ f(x_{0})=r=a_{1}e_{1}(x_{0})+\dots +a_{N}e_{N}(x_{0})=a_{1}e_{1}+\dots +a_{N}e_{N}=f(x)$$ for every $x \in X$. That implies that $ f $ is a constant function so every function in $C(X)$ is constant. But by Urysohn's lemma I can find a continous function s.t $f(x)=1$ and $f(y)=0$.
The mistake is that you seem to assume that $e_i$ are constant functions, which doesn't have to be true.
You can try this.
Inductively construct a sequence of disjoint nonempty open sets $(V_n)_n$ like this:
Take $x, y \in X$, $x \ne y$. There exist disjoint open sets $U, V$ such that $x \in U$, $y \in V$. In particular $X\setminus \overline{U} \ne \emptyset$.
If $X\setminus \overline{U}$ is infinite, set $V_1 = U$.
On the other hand, if $X\setminus \overline{U}$ is finite, set $V_1 = X\setminus \overline{U}$. Then $V_1$ is a finite nonempty open set so it is also closed and hence $X\setminus \overline{V_1} = X \setminus V_1$ is infinite.
In either case, $X\setminus \overline{V_1}$ is infinite so we can inductively continue with the compact Hausdorff space $X\setminus \overline{V_1}$.
Now pick $x_n \in V_n$. By Urysohn's lemma there $\exists f_n \in C(X)$ such that $f(x_n) = 1$ and $\operatorname{supp} f_n \subseteq V_n$.
Since $\{f_n\}_{n\in\mathbb{N}}$ are nonzero and have disjoint supports, they are clearly linearly independent so $C(X)$ is infinite-dimensional.