Shalom and thank you for your question! You ask if the story you came across is true, that Moses was commanded to fight against a certain nation and obliterate them entirely, man, woman and child. It is true. Why on earth would this be so?
The Sages of the Talmud, (known as the Oral law, which was handed down through the generations from Moses onwards,) call the Jewish people a nation who is “merciful, shy, and does good deeds.” While this is not always obvious or manifest, it is potentially true of every Jewish person. It is very hard if not impossible to reconcile this with such a story, seemingly vengeful and cruel, if we take it at face value.
In the book of Exodus 17:1-8, we find that the nation of Amalek attacked the Jewish people on their way out of Egypt, in a place called Rephidim. If we go back further, we find that Amalek was descended from the wicked Esau, who hated Jacob, the progenitor of the twelve tribes and the Jewish nation. Amalek attacked the Jews for no reason other than the fact that they were the people G-d had chosen to receive the Torah and the land of Israel. They attacked in a cowardly manner, at the rear end of the procession of Jewish people making their way through the desert. They attacked those who lagged behind because they were weaker and more tired than the rest. There is much discussion among the commentaries as to what all this really teaches us, and additional horrific details of the attack. However, to understand the true meaning of all this, we need to examine it a little further.
The command to physically eradicate the nation of Amalek was a one-time command. Spiritually however, it is an eternal command, (See Deuteronomy 25:17-19) because there lurks a spiritual Amalek inside of us. It is the voice of cynicism, it is the voice that tells us not to even begin a morally worthwhile project, because no-one needs it anyway, or some such excuse. Moreover, the numerical value of the Hebrew word for Amalek, (the Hebrew letters have numerical values from which we learn additional teachings in the Torah,) is equivalent to that of the Hebrew word for doubt. For our emotional and spiritual health, we need to make sure not to remain in doubt. Life brings us constant challenges and obstacles. We set out to tackle a new stage in our life, only to encounter some obstacle, external or internal. We become confused and overwhelmed sometimes, and are unsure of which path to take, or we tend to despair of making progress. This is the spiritual Amalek, that we must wipe out by having spiritual mentors and guides, and making sure to take counsel with them, so that we can progress with confidence. Think how much time and energy can be lost when we succumb to dilemmas, not settling on a way to solve them, and we remain in paralyzing doubt?
There are many incidents in the Bible which are hard to understand when judged by modern standards, nevertheless, certain lessons can be learned. As I mentioned above, the nation of Amalek was supposed to be wiped out entirely. As you pointed out, this actually did not take place, because as I mentioned, the Jews were merciful and not inclined to killing women and children. Unfortunately, the survivors of the Amalekite nation became future tyrants who tried to wipe out the Jewish people, like Haman in the story of the Purim holiday. He was a descendent of the Amalekite nation, and persuaded the King Ahasueros to agree to a decree of total annihilation of the Jewish people. It is very likely that otherinfamous tyrants were also descended from that race.
Again, the lesson we must learn from all this, is to progress in a positive manner in our service of G-d, meaning living our life to the fullest in a moral way, according to the dictates of the Torah, if we are Jewish, and the seven Noahide laws if we are not. (These include setting up houses of justice, not comitting idolatery or adultery, not eating flesh of an animal which is still alive, and more,) When we become challenged, we must seek guidance and ways of overcoming the challenges, so that we can live according to our principles, utilizing the talents and resources that G-d has given us.
We are tested by G-d in many ways, one of which is the internal Amalek which tries to cool down our enthusiasm for good things. When we stand up to the tests we increase holiness in the world, to the point where we hopefully will soon see the fulfillment of the prophecy, “Nation shall not lift sword against nation,” and we will live in perfect peace and harmony.