Your own article cites its source, which in similar form is a collection of "interesting" outcomes of machine learning experiments. The relevant portion is here:
when MIT
Lincoln Labs evaluated GenProg on a buggy sorting program, researchers created tests that measured
whether the numbers output by the sorting algorithm were in sorted order. However, rather than actually
repairing the program (which sometimes failed to correctly sort), GenProg found an easier solution: it
entirely short-circuited the buggy program, having it always return an empty list, exploiting the
technicality that an empty list was scored as not being out of order
In turn, that collection cites multiple sources for this anecdote, the most closely related of which appears to be
Weimer W. Advances in Automated Program Repair and a Call to Arms. In: Search Based
Software Engineering - 5th International Symposium, SSBSE 2013, St. Petersburg, Russia, August
24-26, 2013. Proceedings; 2013. p. 1–3.
This presentation was available in PDF form on GenProg's website. It indeed asserts largely the same information on slide 45: a sorting algorithm was requested, the algorithm was tested by "is the output sorted?", and the "fix" provided by GenProg was to always output an empty list since it was considered sorted. The author of that presentation is listed as one of the three primary collaborators developing GenProg, so it seems likely that he has sufficient expertise on the matter to know whether this happened, and to me it seems unlikely that he would make up an anecdote about his software giving undesirable results.
The Machine Learning algorithm used is called GenProg, designed for the technique of genetic programming. GenProg is written in OCaml according to its GitHub page, and is primarily used to debug C programs so that is likely the language which technically contained the Sort(List){ return new List;}
implementation. It likely occurred sometime between the first publication about GenProg and the cited paper about GenProg, so between 2009 and 2013 according to GenProg's publications page.
With regards to "How could this happen?" I would recommend asking on a site more focused on the technicalities of machine learning such as ai.stackexchange.com or stats.stackexchange.com.