While you can make certain choices and use spells that may be considered morally questionable, you cannot canonically be evil in Hogwarts Legacy. Essentially, there's no version of the story where you'll be recognised as inherently evil and rise up as a proto-Voldemort.