In the 1950s, a guy named Ras Shamra unearthed tablets which may describe a Ugaritic pagan ritual of a kid being cooked in milk. You can read all about Ras Shamra's discoveries in this PDF document (info on this topic on p.5).
In the above article and in countless others I've read, this ritual is described as historical fact and assumed without any reservation.
In this great article by Jacob Milgrom, the actual significance of Shamra's discovery is addressed:
In one of its mythological tablets, the following line appears:
tb[hg]d bhlb annh bhmat, which was translated as "Coo[k a ki]d in
milk, a lamb in butter." This text, it should be noted, being broken,
requires reconstruction. The reconstruction is, at best, an educated
guess — undoubtedly influenced by our biblical prohibition. However,
this reconstruction was accepted at once by virtually every
interpreter, and it became a dogma of scholarship that Maimonides'
intuition concerning the practice as a pagan rite was correct. A
notable early skeptic was Gordon, who suggested that "tb[h]" could
mean "slaughter." Other objections posed by Loewenstamm and
reinforced by Haran have once and for all vitiated the
reconstruction. The objections are as follows:
(1) The broken passage must now be read differently:
tb.[g]d, which indicates that the dividing mark between the two
words follows tb, thereby leaving no room for adding the letter h.
Thus the reconstruction tb[h]," must be rejected.
(2) Moreover, even were the reconstruction correct, tbh does not mean
"cook," but "slaughter."
(3) The probability is that the term annh, contained in the next
clause, corresponding to Akkadian ananihu, which means "garden" or
"plant," does not refer to an animal but to an herb.
(4) It therefore follows that [g]d — presuming the correctness of the
reconstruction — cannot mean "kid" but, since it must correspond in
meaning to the parallel word annh, also connotes a plant. Hence, tb[h]
— keeping in mind that the reading is speculative — cannot mean
"slaughter," a term hardly appropriate for a plant.
(5) Finally, there is nothing in the text which states that the kid
was cooked in the milk of its mother, in which case it has absolutely
nothing to do with our biblical prohibition!
In sum, the Ugaritic text in question is a broken one, its suggested
reconstruction is palpably wrong, its clearer portion has been
misconstrued, and a key word of the biblical prohibition, "mother," is
not there. In recent memory, nothing matches this example of the
hazards in interpreting broken texts on the basis of a purported
biblical echo. Thus, the cultic theory cannot be grounded in Ugaritic
practice and, without any support, biblical or extrabiblical, it must
be abandoned.
In response to the OP's question:
In all likelihood, the law speaks to a sensitivity toward animals and a disgust at the moral callousness of a person who boils an animal in its mother's milk. This prohibition is not unlike Deuteronomy 22:6:
If you come across a bird’s nest beside the road, either in a tree or
on the ground, and the mother is sitting on the young or on the eggs,
do not take the mother with the young.
(NIV)
Similarly in Leviticus 22:8:
Do not slaughter a cow or a sheep and its young on the same day.
(NIV)
See the continuation of Milgrom's article for a survey of many possible explanations and his own.
Lastly, if you don't find any of the aforementioned answers compelling that's okay because many biblical prohibitions are hard or impossible to explain e.g.: the dietary restrictions, ritual purity and impurity, sacrificial rites and countless others.