Without disputing any of other answers, I wanted to provide more interpretations and arguments:
Emendation switching "Amalek" with "valley"
Several manuscripts of the LXX have “in the valley” rather than “into Amalek.”
Brannan, R., & Loken, I. (2014). The Lexham Textual Notes on the Bible (Jdg 5:14). Bellingham, WA: Lexham Press.
Interpeting "Amalek" as a geographic marker in which some Ephramaites lived
New American Commentary:
From the New American Commentary:
The following phrase, “whose roots were in Amaleq,” makes little sense
in the context unless at this time the Amalekites (who later joined
with the Midianites in oppressing Israel; cf. 6:3) had established a
foothold in some of the Ephraimite highlands.
Block, D. I. (1999). Judges, Ruth (Vol. 6, p. 232). Nashville: Broadman & Holman Publishers.
Keil & Delitzsch's commentary:
“From (מִנִּי, poetical for מִן) Ephraim,” sc., there came fighting
men; not the whole tribe, but only nobles or brave men, and indeed
those whose roots were in Amalek, i.e., those who were rooted or had
taken root, i.e., had settled and spread themselves out upon the
tribe-territory of Ephraim, which had formerly been inhabited by
Amalekites, the mount of the Amalekites, mentioned in Judg. 12:15 (for
the figure itself, see Isa. 27:6, Ps. 80:10, and Job 5:3). “Behind
thee,” i.e., behind Ephraim, there followed Benjamin among thy
(Ephraim’s) people (עֲמָמִים, a poetical form for עַמִּים, in the
sense of hosts).
Keil, C. F., & Delitzsch, F. (1996). Commentary on the Old Testament (Vol. 2, p. 230). Peabody, MA: Hendrickson.
Bible Knowledge Commentary:
The explanation about Ephraim’s roots being in Amalek (v. 14)
apparently indicates that the Ephraimites lived in the central hill
country previously occupied by the Amalekites.
Lindsey, F. D. (1985). Judges. In J. F. Walvoord & R. B. Zuck (Eds.), The Bible Knowledge Commentary: An Exposition of the Scriptures (Vol. 1, p. 390). Wheaton, IL: Victor Books.
interpreting "root" as "rooted out" or defeated
LXX : Ephraim rooted out those in Amalek,
The Lexham English Septuagint. (2020). (Second Edition, Jdg 5:14). Bellingham, WA: Lexham Press.
And JPS Commentary:
One solution that continued into the Middle Ages was to
interpret the passage as referring to heroes who stemmed from Ephraim
and fought against Amalek (e.g., Joshua and Saul; see Exod. 17:8–13
and 1 Samuel 15, respectively). Compare Targum Jonathan, Rashi, and
Kimḥi.
Fishbane, M. A. (2002). Haftarot (p. 104). Philadelphia: The Jewish
Publication Society.
Also, Rashi:
In Ephraim. From Ephraim emerged the root of Joshua bin Nun's
dominance over Amaleik ( Joshua was descended from Ephraim, son of
Yoseif, and Amaleik was a descendant of Eisov. Scripture states, “The
house of Yaakov shall be fire, the house of Yoseif flame, the house of
Eisov chaff” [Ovadiah, 18], teaching that the descendants of Yoseif
shall devour the descendants of Eisov as flame consumes chaff.
(Yalkut, 51. Cf. Rashi to [[Genesis, 30:25]])) when he debilitated
them with the sword.24([[Exodus, 17:13]].) This passage is related to
the preceding one, as it explains ""Adonoy empowered me over the
mighty"" by establishing Joshua's dominance over Amaleik.
Rashi Commentaries. (n.d.). (p. 860).
One problem with this interpretation is that root is in construct form attached to Amalek, so viewing it as "rooted out" rather than "root of" would require some textual emendation.
That this is a prophetic passage that describes some of Ephraim who will behave like Amalekites later in Judges
Here is the NICOT commentary:
What we get is a rather cryptic statement about the Ephraimites which
is at best ambivalent and at worst entirely (and sarcastically)
negative. The meaning depends largely on how we take the opening
phrase, minnî ʾep̱rayim. If the minnî is partitive, it could mean
“some [a few] Ephraimites.” If it is originative, what we would then
have is a blanket statement: “Those who are from/of Ephraim” (i.e.,
the Ephraimites in general). Since, however, verses 14 and 15 in
general deal with tribes that did participate, it seems best to take
this opening statement as positive: “Some [went down] from Ephraim.”
What follows, though, can hardly be anything other than negative:
literally, “their root [was] in Amalek.” Overall the force of the line
seems to be that while volunteers did come from Ephraim, they
displayed some “Amalekite” characteristics; that is, they were
hostile, quarrelsome. At this stage in the book such a mixed report on
the Ephraimites is very puzzling, but the negative aspect of it will
be confirmed by the way the Ephraimites behave in both the Gideon and
Jephthah episodes, which follow (8:1–3; 12:1).
Webb, B. G. (2012). The Book of Judges. (R. K. Harrison & R. L. Hubbard Jr., Eds.) (p. 211). Grand Rapids, MI; Cambridge, UK: William B. Eerdmans Publishing Company.