The fight with Yamata no Orochi requires you your focus and high mobility. Therefore, it is a good idea to wear an armor that ensure s exactly that. The battle consists of three parts.
From the water, the head of the beast emerges and it attacks in two ways. The first one is magic attack. To avoid damage, it is best to dash up to the wall behind you. The other attack is a swing with the head. This can be blocked or you can dodge from it. To defeat the opponent, dash up to the roof's edge and slash his neck. If he steps back, return to the wall and wait for your next opportunity. If his health bar drops to zero, he drops into the water and the next part of the battle starts.
In this phase, you will have to fight two opponents. Attacking and defense are the same, but this time, you have to watch out for two of them. The best way is to focus on one of them, destroy the head, at which point you can focus on the other one and use the same tactic.
The last part of the battle is the most difficult, because you are under simultaneous attack from six heads. The key here is to focus on one head at a time. Otherwise, you will be pepper4ed with attacks. The tactic is the same as previously. You dash up to the edge, deal damage and move away to a safe distance. Then repeat. Here, you also have to keep an eye on your health at all times, not to miss the moment when you need to use a potion. After the battle, the ending cutscene starts.