When and why did it become a thing to censor a nations history to remove the unwanted and create a nationalist view for the youth to learn? Why not give the whole account good and bad?
History has always been political, because it is powerful. Telling false and exaggerated stories about the past is a way of changing people's conception of who they are, why the world is the way it is, and constraining the possibilities of the future. As for when this became a thing, it is perhaps better to talk about when it stopped being the norm for historical accounts to tell tales in this way, because over the course of human history the vast majority of historical accounts, as early as we have them, are in this vein. This is the history that is written on the side of temples, this is the history that is passed down in sacred scriptures, this is the history of royal chronicles, this is the history of textbooks commissioned by states. History matters: it is what feeds a sense of identity, of purpose, of justice. Wars, revolutions, assassinations, riots, insurrections — all of these have been tied to the histories that people carry around with them in their heads. This is why powerful institutions (whether they be states, religions, private companies, what have you — it varies by time) always have an interest in what type of history is being told. Even the idea of nationalism, based around the concept of a shared culture/language/identity called the "nation," is one explicitly based on a particular reading of history (as opposed to one that emphasized, say, religious solidarity) — e.g., that there is an "Italian people" bound by "shared history" that is somehow more unified than it is different, despite the history of Italy being fractious and split into different states and languages and religions, was one of the hallmark claims of early Italian nationalism.
The idea that history ought to somehow get beyond this, be a real "profession" rather than a propaganda device, be something that doesn't just tell the story that benefits the narrative of the powers-that-be... that is much more recent. One sees glimmers of that ideal throughout the past but it is not until the 19th century or so that history starts to "professionalize" and try to deal with the past "objectively." It is not as easy as it sounds — there is no better cloak for biases than the mantle of objectivity, and even knowing what objectivity means, much less whether it can be achieved, is controversial once you start taking it seriously. (See esp. Peter Novick, That Noble Dream: The 'Objectivity Question' and the American Historical Profession, for one history of the attempts to deal with "objectivity.")