To determine the efficient frontier of a mean-variance framework, one needs estimates of the expected return $r_i$, the variance $\sigma_i^2$ and the co-variance $\sigma_{ij}^2$ for each stocks $i$, $j$. For $n$ stocks, you have to estimate a total of $\frac{n(n-1)}{2}$ correlation coefficients. Index models are used, to reduce this huge amount of needed estimates.
Single Index Models
It is assumed, that the return of a stock can be written as
$$r_i = a_i + \beta_i r_m + e_i$$
,where $r_m$ denotes the market-return, $e_i$ a mean-zero error term and $\beta_i$ a stocks beta. The key assumptions are:
$$\operatorname{E}[e_i(r_m-\bar{r}_m]=0$$
$$\operatorname{E}[e_ie_j]=0$$
This implies, that the only reason stocks vary together, systematically, is because of a common comovement with the market. One can show, that the covariance can be expressed as
$$\sigma_{ij}^2 = \beta_i \beta_j \sigma_m^2$$
, where $\sigma_m^2$ denotes the variance of the market-return. In summary, if you assume the single-index model, you just have to estimate a total of $3n+1$ parameters for $n$ stocks.
CAPM
The CAPM is an economic theory in equilibrium with further assumptions for an investor's utility-preference function, costless diversification,...
Combing the economic theory from Markowitz portfolio-diversification, Von Neumann and Morgenstern expected utilities etc. leads to the CAPM (where $r^f_t$ denotes the risk-less rate of interest):
$$r_{i,t}-r^f_t = \alpha_i + \beta_i(r^m_t-r^f_t)+ \epsilon_{i,t}$$
, with the following (strong) assumption:
$$\alpha_i = 0$$
You may look at this excellent answer with more details.
Differences from Single Index Models and the CAPM
In fact, the single index model is just a statistical technique, because you can replace $r_m$ with any other variable you think fits best to explain a stocks return. The CAPM however is an economic model in equilibrium, where the market-portfolio return $r_m$ is a clearly determined portfolio (of all risky assets, investments, also human-capital...). See also this answer:
The $\beta_i$ for a stock in the single-index model is not the same $\beta_i$ as in the CAPM.
Reference:
Elton/Gruber/Brown/Götzmann (2014), Modern Portfolio Theory and Investment Analysis, ed. 9, John Wiley & Sons.