$k$ is a continuous variable. This is simply because if you imagine all possible plane waves on an infinite line, they have the form $e^{ikx}$, where $k$ is any real number.
So to expand a function $\psi(x)$ into the $k$ basis, you would want to have a sum over every possible value of $k$, of a coefficient $c_k$ times the basis function $e^{ikx}$. But you can't sum over a real valued quantity; when you use $\Sigma$ notation, the index must be integer valued (aka, discrete).
There is a fix for this, which is to discretize the values of $k$ into an array of values $k_n = \frac{n}{N} k_{\rm max}$, with $n=-N, 1, \cdots, N$, and then take the limit $N\rightarrow \infty$. In this setup, we have actually have also truncated the range of $k$ so it spans from $-k_{\rm max}$ to $+k_{\rm max}$ instead of $-\infty$ to $+\infty$; to correct for this error we will also simultaneously take the limit $k_{\rm max} \rightarrow \infty$ in what follows. In equations, the limit we are taking has the form
\begin{equation}
\psi(x) = \lim_{k_{\rm max}\rightarrow \infty}\lim_{N\rightarrow \infty} \sum_{n=-N}^N c_{k_n} e^{i k_n x}
\end{equation}
In order to be able to take the limit in a clean way, we re-express the coefficient $c_{k_n}$ as $c_{k_n} = \phi(k_n) \Delta k$, where $\Delta k = k_{n+1}-k_n=\frac{k_{\rm max}}{N}$ is the distance between neighboring $k$ values in our grid. This step can be done without loss of generality because it is just a definition of $\phi(k_n)$; we are only doing it to make the limit easier to take.
Then the expression becomes
\begin{equation}
\psi(x) = \lim_{k_{\rm max}\rightarrow \infty} \left[\lim_{N\rightarrow \infty} \sum_{n=-N}^N \phi(k_n) e^{i k_n x} \Delta k \right]
\end{equation}
At this point, you should recognize the definition of the Riemann integral in the square brackets above. After using the definition, we have
\begin{equation}
\psi(x) = \lim_{k_{\rm max}\rightarrow \infty} \int_{-k_{\rm max}}^{k_{\rm max}} d k \phi(k) e^{i k x} = \int_{-\infty}^\infty dk \phi(k) e^{ikx}
\end{equation}
which is the integral expression you are interested in. As you can see, the integral does arise from a sum of an expansion coefficient times a basis function. However, the mathematical details of detailing with a continuous "index" $k$ led us to express the sum as a limit (which became an integral), instead of an ordinary sum.
The extra factors of $\sqrt{2\pi}$ are just conventional normalizations; we can always rescale $\phi(k)$ to obtain that normalization. I didn't do it here because that is just a detail and I wanted to focus on the main idea. Similarly, while I have not explicitly included the time dependence, it is easy to put it in since each plane wave $e^{ikx}$ is an energy eigenstate for a free particle, so the time evolution simply amounts to multiplying each basis function by a phase $e^{-i E t/\hbar}$, where $E=p^2/2m=\hbar^2 k^2/2m$ is the energy.