The celebrated time hierarchy theorem for Turing machines states, informally, that more problems can be solved given more time. The extent to which a time hierarchy--type theorem holds in the classic distributed $\mathsf{LOCAL}$ model has been open for many years. In particular, it is consistent with previous results that all natural problems in the $\mathsf{LOCAL}$ model can be classified according to a small constant number of complexities, such as $O(1),O(\log^* n), O(\log n), 2^{O(\sqrt{\log n})}$, etc. In this paper we establish the first time hierarchy theorem for the $\mathsf{LOCAL}$ model and prove that several gaps exist in the $\mathsf{LOCAL}$ time hierarchy. Our main results are as follows: (a) We define an infinite set of simple coloring problems called hierarchical $2\frac{1}{2}$-coloring. A correctly colored graph can be confirmed by simply checking the neighborhood of each vertex, so this problem fits into the class of locally checkable labeling (LCL) problems. However, the complexity of the $k$-level hierarchical $2\frac{1}{2}$-coloring problem is $\Theta(n^{1/k})$ for $k\in\mathbb{Z}^+$. The upper and lower bounds hold for both general graphs and trees and for both randomized and deterministic algorithms. (b) Consider any LCL problem on bounded degree trees. We prove an automatic speedup theorem that states that any randomized $n^{o(1)}$-time algorithm solving the LCL can be transformed into a deterministic $O(\log n)$-time algorithm. Together with a previous result [Y.-J. Chang, T. Kopelowitz, and S. Pettie, Proceedings of FOCS, 2016, pp. 615--624], this establishes that on trees, there are no natural deterministic complexities in the ranges $\omega(\log^* n)$---$o(\log n)$ or $\omega(\log n)$---$n^{o(1)}$. (c) We expose a new gap in the randomized time hierarchy on general graphs. Roughly speaking, any randomized algorithm that solves an LCL problem in sublogarithmic time can be sped up to run in $O(T_{LLL})$ time: the complexity of the distributed Lovász local lemma (LLL) problem. In other words, the LLL is complete for sublogarithmic time. Finally, we revisit Naor and Stockmeyer's characterization of $O(1)$-time $\mathsf{LOCAL}$ algorithms for LCL problems (as order-invariant w.r.t. vertex IDs) and calculate the complexity gaps that are directly implied by their proof. For $n$-rings we see an $\omega(1)$---$o(\log^* n)$ complexity gap, for $(\sqrt{n}\times \sqrt{n})$-tori an $\omega(1)$---$o(\sqrt{\log^* n})$ gap, and for bounded degree trees and general graphs, an $\omega(1)$---$o(\log(\log^* n))$ complexity gap.