Group IDs and User IDs are independent. The same number may be used for user "foo" and group "bar".
Some Linux distributions by default create a new group "foo" when you create user "foo", both having the same numerical ID. (This kills the very notion of group, IMHO.)
ls by default shows the group name, but the filesystem stores the numerical group ID. If a group is removed, files belonging to it are not, then ls shows the numerical ID.
So the situation you observe may come from, e.g.:
- creating a user who gets affected number 1002 and implying creation of group 1002, then removing this user (assuming the distribution tools then remove the associated group)
- syncing a file from another computer where its owning group has number 1002