This passage is a blessing given by Moses to the tribe of Levi at the time of his death (as noted in Deuteronomy 33:1). In this chapter Moses goes tribe-by-tribe to pronounce a blessing over each.
It is believed by numerous commentators that "Who said unto his father and to his mother, I have not seen him; neither did he acknowledge his brethren, nor knew his own children" is specifically referring to the incident in Exodus 32:25-29 in which the Levites have to slay their brothers, spouses and neighbors as penitence for their sin of worshiping the golden calf.
For instance, John Gill notes in his Exposition of the Old Testament
Who said unto his father and to his mother, I have not seen him,.... Which some understand of the high priests who were of this tribe, and according to the law were not to defile themselves, or mourn for a father or mother, Leviticus 21:11; or rather, as others, of their having no respect to them in judgment, but determining all causes that came before them according to the law of God, and the rules of justice and equity, in the most impartial manner, without having any regard to the nearest relations to them: with this compare what Christ the antitype of Levi says, in Matthew 12:49,
neither did he acknowledge his brethren, nor knew his own children; had no respect to persons in judgment, though ever so nearly related: many restrain this to the affair of the golden calf, when the tribe of Levi gathered together, girded their swords on their thighs, and slew every man his brother, companion, and neighbour, guilty of that idolatry, Exodus 32:26.
Similarly, in their Commentary Critical and Explanatory on the Whole Bible, Robert Jamieson, A. R. Fausset and David Brown write:
8-10. of Levi he said—The burden of this blessing is the appointment of the Levites to the dignified and sacred office of the priesthood (Le 10:11; De 22:8; 17:8-11), a reward for their zeal in supporting the cause of God, and their unsparing severity in chastising even their nearest and dearest relatives who had participated in the idolatry of the molten calf (Ex 32:25-28; compare Mal 2:4-6).
Matthew Poole concurs in his commentary, Synopsis criticorum biblicorum noting:
I have not seen him, i.e. I have no respect unto them, for so knowledge is oft used, as Job 9:21 Proverbs 12:10,11 1 Thessalonians 5:12. The sense is, who followed God and his command fully, and executed the judgment enjoined by God without any respect of persons, Exodus 32:26,27. This seems better than to refer it either to their not mourning for their next kindred, for that was allowed to all but the high priest in case of the death of father or mother, and that was only a ceremonial rite, and no matter of great commendation; or to their impartiality in executing the judgments committed to them, Deu 17:9, of which they had as yet given no considerable proof.
Joseph Benson also agrees, saying in Holy Bible, containing the Old and New Testaments ... with Notes, Critical, Explanatory, and Practical:
Who said to his father, &c., I have not seen him — That is, I have no respect unto them in comparison of God and my duty. The meaning is, Who followed God and his command fully, and executed the judgment enjoined without any respect of persons. It appears to refer to the whole tribe of Levi, who, fired with a holy zeal for God and his worship, performed impartial execution on the worshippers of the golden calf, not excepting even their nearest relations that were concerned in that wickedness: see Exodus 32:26-29.
Finally, John Wesley states in his Explanatory Notes:
I have not seen him — That is, I have no respect unto them. The sense is, who followed God and his command fully, and executed the judgment enjoined by God without any respect of persons, Exodus 32:26,27.
They kept thy covenant — When the rest broke their covenant with God by that foul sin of idolatry with the calf, that tribe kept themselves pure from that infection, and adhered to God and his worship.
So there is pretty overwhelming agreement among scholars and commentators that this refers to the golden calf incident in Exodus 32. It seems though that this was not something which was said literally - that is, it is not a direct quote, but instead something that was figuratively said through the actions of the Levites. It seems that this action by the Levites demonstrated the devotion of the Levites in such a pleasing way to Moses such that he chose to include this in his blessing and bless the tribe of Levi accordingly.