All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The Hadeeth was narrated by Al-Bukhaari, Muslim, and others.
As for its explanation, Daleel Al-Faaliheen Li-Turuq Riyaadh As-Saaliheen authored by Ibn ‘Allaan As-Siddeeqi reads: “It was narrated on the authority of Abu Hurayrah that the Prophet said: ‘People (as individuals) are (like) metals (in terms of being genuinely good or evil according to what Allah gave them readiness for) of gold and silver (the similarity between them is that metals have different natures, some are precious, and others are of little worth, and the characteristics exhibited by each metal correspond to its original nature. Likewise, every human being exhibits the characteristics that correspond to his original nature, in terms of dishonor or honor); the best among them in the Pre-Islamic Era of Ignorance (those who were of a noble nature in the pre-Islamic era, referred to as the Era of Ignorance because of the numerous manifestations of ignorance displayed then) are the best after their conversion to Islam if they understand it fully ... (meaning when the full understanding of Islam becomes their new nature; i.e. these people attained through the honor of embracing Islam and understanding it fully the same status that they had in the pre-Islamic era in terms of nobility, generosity, tolerance, and the like). And the souls are recruited soldiers (this sentence is grammatically in conjunction with the first sentence “people are (like) metals,” and it means that the souls are in groups of different natures); those who are in agreement will be friendly to each other, and those who are in disagreement will be averse to each other.’ As-Suyooti said: ‘Al-Khattaabi said: “His statement ‘the souls are…’ could be a reference to the similarity in their inclination to good or evil. A good person is naturally inclined to those who are good, and similarly, an evil person is inclined to his counterparts. The agreement among souls occurs in accordance with their original natures and inclination to good or evil. If they are in agreement, they will be in affinity; otherwise, they will be averse to one another. I said: ‘This explanation was stated by the author in Sharh Muslim, on his authority and on the authority of others.’"'
Ibn Al-Jawzi said: 'It is deduced from this Hadeeth that if a person finds in himself an aversion to someone who is good and righteous, he should investigate the reason for such aversion in order to strive in eliminating it and get rid of this dispraised description, and vice versa.’ Ibn ‘Abd As-Salaam said: ‘What is meant by agreement and disagreement in this context is the convergence and divergence in terms of qualities, because a person disagrees with those who have opposing qualities, and one disagrees with what is unknown to him due to ignorance of it. This is a figurative analogy; the Hadeeth likened what is disagreeable to what is unknown and what is agreeable to what is known [through the Arabic terms used to denote them]. The whole Hadeeth was narrated by Muslim, and Al-Bukhaari narrated the part: “…and the souls are…” until the end of the Hadeeth on the authority of ‘Aa’ishah, meaning that this part was narrated by both of them but from two different chains of narrations).’” [End of quote]
Allah Knows best.