Hogwarts Legacy has various spells designed to aid you in the journey to stopping evil Goblins. As expected, the game also has the infamous unforgivable curses such as the Avada Kedavra (the killing curse), Imperio (mind-controlling curse), and Crucio (torture curse).

However, you cannot access these spells until quite late into the game, and for a good reason. These unforgivable curses are part of the dark arts and are extremely overpowered. You are not obligated to learn these unforgivable curses, but you can always do so whenever you want, even after completing multiple side-quest chains linked with the spells.
Fortunately, unlike the movies, learning these unforgivable curses will not land you behind the walls of Azkaban. But, getting to these spells requires you to go through a lengthy questline involving Sebastian Sallow. Here's how you can get all three unforgivable curses in Hogwarts Legacy.
To begin with, you need to speak to Sebastian as he is arguing with his best friend, Ominus, outside the Undercroft entrance. The quest will be marked on the map and called 'In the Shadow of the Bloodline.' After this interaction, wait for one in-game day, and the next quest will appear. This is when you can start learning the first unforgivable curse.
Crucio
The first unforgivable curse you learn is called Crucio or the torture curse. Upon casting this spell, enemies will take extra damage. To get this curse, you need to start a quest called 'In the Shadow of the Study,' which will show up after the 'In the Shadow of the Bloodline' interaction.
You will be tasked with going to the Scriptoinum to learn more about Ominus' aunt and her death. You need to open up a door, requiring you to light up three pillars with braziers on top of it. There will be two braziers on the right side of where Sebastian is standing and one on the left side of Ominus or across the door.
When you reach the bottom, you will find a broken mirror. Use your Reparo spell to repair the mirror and wait for Ominus to speak Parselmouth and open the serpent door ahead.
Now, you will enter a "maze-like" area with several rooms and three Slytherin Locks, each connected to a locked door. When you enter, the first door you see to your right will have some symbols, and the Slytherin Lock in front of it opens it.
To open this door, you will notice two symbols on it. Both these symbols are on a dial of the Slytherin Lock in front of it.
Do not go through that door yet. Instead, turn left, and you will find two doors. One to the left, which is half broken, and one to the right, which is locked. To open the door to the right, you need to go to the room on the left with a broken door.
Once inside, you will find another Slytherin Lock, which will help open the door to the right.
Now you can go through the unlocked door to find yet another locked door. Observe the symbols on this door, and backtrack to the first door you unlocked.
Go through the first unlocked door, and at the end of the pathway, you will find yet another Slytherin Lock.
You can now go through the unlocked door with Sebastian and Ominus. As you go through the door, you will enter a narrow room, and the door behind you will get locked.
You will find a journal by a skeleton near the door with a face ahead of you. It will also have 'CRUCIO' written on the floor next to it.
Go through the dialogues until you get an option to learn Crucio. Choose the one that says you want to learn the spell.
Go through the door and pick up the Slytherin Spellbook directly ahead of you.
Afterward, go upstairs and speak with Sebastian, after which you can leave the Scriptorium. And that's how you learn the Crucio spell.
Imperio
The next spell you learn is the Imperio spell. For this spell, you must progress through the story until you get a quest called 'In the Shadow of Time.' You will first get 'In the Shadow of Discovery,' where you will have a small dialogue with Sebastian in the Undercroft.
Once the dialogue ends, you can wait by skipping time, and then you will see the 'In the Shadow of Time' quest pop up in the quest log.
For this one, you and Sebastian will go inside a spider-infested catacomb to find an ancient relic. Progress through the catacombs, and you will eventually come across a large room that requires you to find three batches of skeletons to create a doorway.
First, pick up the journal by the Altar in the middle of the room and then speak to Sebastian.
After speaking to Sebastian, use the Wingardium Leviosa spell to pick up the skeleton off the pedestal and bring it to the unfinished doorway directly in front of you.
Now, you need to find two more batches. The second is inside a tomb to the right of the Altar. Use Revelio to reveal the skeleton and use Accio to open the tomb.
Finally, the last batch is inside a room to the right of the doorway. It will be blocked.
Once inside, use Accio to open the tomb to your right and get the skeleton.
After bringing the third skeleton to the doorway, it will be completed, revealing a path ahead of you.
In this room, Sebastian will stop you and talk to you about the Imperio curse.
All you have to do is continue the quest to its completion. From this room, go to the blocked room to your right by opening it using your Bombardo spell.
In this room, you need to complete a skeleton doorway once again. Most skeletons are locked behind stone walls that can be opened by pulling the handles above symbols using Accio.
Once identified, see the symbols on the stone door and pull the handles with those symbols to open the door. The rest of the quest is straightforward.
Avada Kedavra
After the previous quest, you will get a final quest with Sebastian called 'In the Shadow of the Relic' that will unlock the most unforgivable curse called Avada Kedavra. The spell certainly lives up to its reputation, even in this game, as it instantly kills any enemy in the game.
This quest is quite straightforward. In this one, you are contacted by Ominus, who is gravely concerned about his friend Sebastian.
Once you enter the catacombs, you need to go deeper by fighting hordes of Inferi.
When you get to Sebastian, a small cutscene will play, after which you get into a boss fight with someone familiar.
Once the fight is over, you will leave the catacombs with Sebastian, during which you can choose the dialogue option 'Everyone should know that curse' to learn the Avada Kedavra.
And that's how you learn all three unforgivable curses. These curses are extremely powerful, and with the right talents, you can create one of the most powerful wizards or witches in Hogwarts Legacy.