Converting my [comment](https://mathoverflow.net/questions/447519/bounding-size-of-group-by-number-of-generators-order-of-elements-and-nilpotenc#comment1156329_447519) into an answer:

Let $G = G_1 \ge G_2 \ge \cdots$ be the lower central series. Then $G_k/G_{k+1}$ is spanned by the left-normed commutators $[x_1, \dotsc, x_k]$ with $x_1, \dotsc, x_k \in \{g_1, \dotsc, g_m\}$, of which there are at most $m^{k-1}(m-1)$ nontrivial for $k > 1$ (since $x_1 \ne x_2$). Therefore
$$\dim G \le m + \sum_{k=2}^C m^{k-1}(m-1) = m^C.$$

This bound is not sharp. For the free Lie algebra, $G_k/G_{k+1}$ has a basis given by the basic commutators, and the number of these is given by [*Witt's formula*][1]:
$$\dim G_k/G_{k+1} = \frac1k \sum_{d \mid k} \mu(d) m^{k/d}.$$


  [1]: https://en.wikipedia.org/wiki/Free_Lie_algebra#Universal_enveloping_algebra