Characters of rational vertex operator algebras tend to yield modular functions. This is due to the space of torus partition functions in a chiral conformal field theory being a complex moduli invariant. The standard example is the monster vertex algebra, whose character is j-744. Other examples come from lattice CFTs (presumably describing a bosonic string propagating in a torus), and have the form of a theta function divided by a power of eta. The characters are never Hecke eigenforms, because of the pole at infinity, but traces arising from higher-weight vectors may be. In some cases, the vertex algebra structure is supposed to arise from geometry of a target space, so this phenomenon may be related to Hirzebruch-Zagier (number 5).
Characters of lowesthighest weight representations of affine Kac-Moody algebras yield modular forms. One can reasonably argue that this is a special case of the previous paragraph, since (I think) they come from Wess-Zumino-Witten. The Weyl-Kac character formula for such representations is one way to get Macdonald identities, and the smallest case (trivial rep of affine sl2) yields the Jacobi triple product.