The idea of compact came from sequences. You can see how one might come up with the name 'compact' to describe a set where you can't have an infinite set of points that are a minimum fixed positive distance from each other; that would not be a 'compact' set. Finding a cluster point gives you way to find a limit, and that's the importance of a 'compact' set. These notions were being formulated in the last part of the 19th century, around the time that a real number was rigorously defined for the first time!
Around the same time, people began studying differential equations by reformulating them in terms of integral equations. Such formulations were much nicer than direct formulations of differential equations. Iterative techniques allowed people to come up solutions. But you had to be able to find some sort of limit. There's where compactness came in handy.
The work of Fredholm was pivotal in this regard. He used a different type of 'compactness' for functions. Integral operators on finite domains often map bounded sequences of functions to ones with uniformly bounded derivatives (equicontinuous.) So one is able to extract a cluster point from such a sequence, and arrive at a limit that will solve some type of ordinary or partial differential equation. The Arzela-Ascoli Theorem concerning equicontinuous families (sequences) of function goes back to that time in the late 1800's, and imrovements of this theorem remain useful today.
The "Fredholm alternative" came out of compactness. Fredholm was able to prove that null spaces of various differential operators would be finite dimensional, and the deficiency in their ranges would also be finite dimensional for common cases on finite domains. This came out of compactness which, in this case, related compactness and dimension: the closed unit ball in a normed space is compact iff the space is finite-dimensional. (Fredholm also approximated integral equations by discrete equations.) Dimension also 'squashes' sets to be compact.
F. Riesz abstracted these techniques to define a 'compact' operator that was modeled after Fredholm's integral operators which mapped uniformly bounded functions to functions with uniformly bounded derivatives. The word 'compact' was a natural term to describe the abstract operator defined by Riesz because of its origin. What other term would you use? The abstraction of Riesz and the proofs he constructed based on Fredholm's work were so well-done that the material taught today is almost unchanged since the time of Riesz' ~1918 work. Compact operators and the Fredholm alternative are perfectly tied together now in operator algebras. The Fredholm index (nullity - deficiency) remains important and now relates to topological notions as well.