Yes, you can cast spells on other students in Hogwarts Legacy outside of combat encounters, but it won’t affect them. While students react to you using spells, they won’t be hurt or harmed.
If you use an attack spell against a friendly NPC in Hogwarts or the open world, they’ll make a comment or move out of the way.
We got to see this first-hand in the previews and early gameplay for Hogwarts Legacy, as many of the people invited to play the game early tried it out.
You can cast spells against other students in the dueling club, and perhaps if Hogwarts Legacy gets multiplayer, you’d be able to use spells against your friends.
However, leaked footage shown via Twitch displayed how you can cast spells against cats in Hogwarts Legacy, including picking them up and hitting them like a regular enemy.
While it’s a strange inclusion, the gameplay, which appears to be completely legitimate, shows the player using Leviosa on a cat before hitting it with the basic attack spell. The cat flies across the room as another cat runs away in fear.
Can You Kill Students in Hogwarts Legacy?
No, you cannot kill other students in Hogwarts Legacy or use any of the unforgivable curses in the game on them.
It goes without saying, but Hogwarts Legacy is not a magical GTA. While this might be unfortunate for those wishing to live out their Voldermort fantasies, it makes sense in the context of the game’s story.
You can use spells like Avada Kedavra in the game, such as in the Dark Arts fighting arena that comes as part of some of Hogwarts Legacy’s editions.

Can You Use Spells inside Hogwarts in Hogwarts Legacy?
Yes, you can cast a limited number of the many confirmed spells in Hogwarts Legacy inside Hogwarts Castle. However, not all of them will have an effect.
While spells like Accio are needed to complete some of the hundred or so side quests inside the castle, most other spells will do nothing or will be completely unavailable.