The paper General Theory of Natural Equivalences by Eilenberg and Mac Lane (1945), where the terminology is first introduced, mentions neither Aristotle, nor Kant, nor even Carnap, who was still alive. The motivation given was:
"In a metamathematical sense our theory provides general concepts
applicable to all branches of mathematics, and so contributes to the current
trend towards uniform treatment of different mathematical disciplines. In
particular it provides opportunities for the comparison of constructions
and of the isomorphism occurring in different branches of mathematics;
in this way it may occasionally suggest new results by analogy."
This roughly corresponds to Aristotelian view of categories as the most general forms of being, or to Kantian view of them as most general forms of thinking. Then again, it also corresponds to their colloquial meaning, which derives from legal Latin. But Mac Lane is a philosopher-mathematician like Hilbert, see McLarty's The Last Mathematician from Hilbert’s Göttingen: Saunders Mac Lane as Philosopher of Mathematics, so philosophical inspiration is not unexpected. Almost 30 years later Mac Lane recalled in Notes to Chapter I of Categories for Working Mathematicians:
"A direct treatment of categories in their own right appeared in Eilenberg-Mac Lane [1945]. Now the discovery of ideas as general as these is chiefly the willingness to make a brash or speculative abstraction, in this case supported by the pleasure of purloining words from the philosophers: "Category" from Aristotle and Kant, "Functor" from Carnap (Logische Syntax der Sprache), and "natural ransformation" from then current informal parlance. Initially,
categories were used chiefly as a language, notably and effectively in the Eilenberg-Steenrod axioms for homology and cohomology theories."
However, the idea that objects are merely relational placeholders in a structure was certainly alien to both Aristotle and Kant. But it was common in French structuralism of the time derived from Saussure, and the notion of structure was taken up by Bourbaki, albeit still tied to the set-theoretic base. Kutateladze in Saunders Mac Lane, the Knight of Mathematics claims that he and Eilenberg were into Kant at the time, but I could not confirm this from a first hand source. Still, he tells an interesting background story which sounds plausible:
"In Mac Lane’s opinion, the conceptions of category theory were close to the
methodological principles of the project of Nicholas Bourbaki. Mac Lane was sym
pathetic with the project and was very close to joining in but this never happened (the main obstacles were in linguistic facilities). However, even the later membership of Eilenberg in the Bourbaki group could not overcome a shade of slight disinclination and repulsion. It turned out impossible to “
categorize Bourbaki” with a theory of non-French origin as Mac Lane had once phrased the matter shrewdly and elegantly. It is worth noting in this respect that the term “category theory” had roots in the mutual interest of its authors in philosophy and, in particular, in the works of Immanuel Kant".
The connection to Carnap also does not seem to go beyond general similarities. Here is from Belnap's paper Under Carnap’s Lamp: Flat Pre-semantics on Carnap's usage:
"At the abstract level that is relevant to our concerns, we think of a grammar as involving the following. Categorematic expressions, such as sentences or terms, with the idea that a semantics will then give a “value” of some kind to each categorematic expression. Syncategorematic expressions, such as “∼” or “&” or “(”, which play a role in some grammatical operation. Grammatical operations, or modes of combination or functors, each of which is a (grammatical) function taking categorematic expressions as input, and producing a categorematic expression as output. Example: the operation which, given two sentential inputs A1 and A2, produces an appropriate “conjunction” of those two sentences, perhaps having the appearance “(A1 & A2)”."
Corfield, quoting Belnap on the n-Category Cafe blog, is ambivalent:"I guess that gives us an idea of why Mac Lane chose it, although I don’t see that the notion of a functor taking arrows as arguments is present." One can see that MacLane could have borrowed not just functors but also categories directly from Carnap. Of course, Carnap himself, like other positivists, was heavily indebted to Kant, see e.g. Friedman's Parting of the Ways.
Why was the word borrowed from philosophers?
seems to be simply that philosophers used categories as key concepts for understanding the world and so do the category theorists, so they took/borrowed/repurposed/stole/hijacked/grabbed/redefined the term.