In cases where multiple different encounters could have originated your Gloom, the program simply picks the first one it finds that is valid.
Oddish can be captured in the Safari Zone area 3 at levels 27 and 29. Gloom can be caught at level 29 and 31.
In your left instance, you have a level 29 Gloom. Assuming the met level is 29, it couldn't have been an Oddish, because it must level up at least once to evolve (but it was met at the level it currently is).
In your right instance, you have increased the level. Since the current level is above the met level, it no longer disqualifies Oddish from being one of the possible origin encounters, and when it finds Oddish first, it further validates it as possible and yields.
Both say it is legal, so there really is nothing to worry about.