We define a two-dimensional topological Yang-Mills theory for an arbitrary compact simple Lie group. This theory is defined in terms of intersection theory on the moduli space of flat connections on a two-dimensional surface and corresponds physically to a two-dimensional reduction and truncation of four-dimensional topological Yang-Mills theory. Two-dimensional topological Yang-Mills theory defines a topological matter system and may be naturally coupled to two-dimensional topological gravity. This topological Yang-Mills theory is also closely related to Chern-Simons gauge theory in 2 + 1 dimensions. We also discuss a relation between SL(2, R) Chern-Simons theory and two-dimensional topological gravity.