I have a scenario, where I need to un-localize an item if it has been localized by the system. Is there a way to find out whether the item has been localized by the user or the system?
What do you mean localized by the system? Do you have some specific system user, which is also Tridion user? In any case, you can always check version 1 of localized Component and see which user did it. It MUST be Tridion user, so that answers your question.
Alternate approach: You can look at the "check-in" comment to figure out whether it is checked in by the user or the system, if the users are adding a check-in comment. This will allow you to differentiate between the commits.
When you localize, the comment will always have "localized from Publication..." as the message from the system and when the user checks it in and they are giving different comments, you can identify the same.