The partition function plays a central role in statistical mechanics.
But why is it called ''partition function''?
First, recall what a partition is. A partition of a set $X$ is a way to write $X$ as a disjoint union of subsets: $X=\coprod_i X_i$, $X_i\cap X_j=\emptyset$ for $i\neq j$. When the elements of the set $X$ are considered undistinguishable, what matters are the cardinals of the set only, and we have a partition of an integer number, $n=n_1+\ldots+n_k$. For numbers, the name "partition function" denotes the number of ways in which the number $n$ can be written like this. It is different than the "partition function" in statistical mechanics, but both refer to partitions.
In statistical mechanics, a partition describes how $n$ particles are distributed among $k$ energy levels. Probably the "partition function" is named so (indeed a bit uninspired), because it is a function associated to the way particles are partitioned among energy levels. An interesting explanation of this can be found in "The Partition Function: If That’s What It Is Why Don’t They Say So!". But I don't know a historical account of this.