The Atiyah-Singer index theorem gives a topological formula for the index of an elliptic differential operator. The topological index depends on a cohomology class that is constructed from the principal symbol of the operator. On contact manifolds, the important Fredholm operators are not elliptic, but hypoelliptic. Their symbolic calculus is noncommutative, and is closely related to analysis on the Heisenberg group. For a hypoelliptic differential operator in the Heisenberg calculus on a contact manifold we construct a symbol class in the $K$-theory of a noncommutative $C^*$-algebra that is associated to the algebra of symbols. There is a canonical map from this analytic $K$-theory group to the ordinary cohomology of the manifold, which gives a de Rham class to which the Atiyah-Singer formula can be applied. We prove that the index formula holds for these hypoelliptic operators. Our methods derive from Connes’ tangent groupoid proof of the index theorem.