Usually, when there is randomness that defies business logic like this (a product randomly added to a category make no business logic whatsoever), its due code that was written for trial purposes, but was later forgotten and simply left there.
If you have you project under version control you may have a good and rather simple way: go through individual commits and look for a code that may resemble to assigning random categories.
Otherwise, it would be a very long shot to expect that there would be intentional code that comes from any requirements, yours or from any third party. So, yeah, chances are this is a mistake from a co-worker or someone who used to work on the same project earlier.
I hope this helps.