'Sekiro' Boss Guide: How to Beat Gyoubu the Demon
General Gyoubu "The Demon" Masataka Oniway is described in Sekiro: Shadows Die Twice as "an extraordinary foe." He is the keeper of the Ashina Castle Gate and has an array of devastating attacks. The first major boss in Sekiro, defeating Gyoubu the Demon requires finesse, speed and luck.
Gyoubu the Demon's reputation precedes him. Eavesdropping reveals the esteem in which he's held. "Ashina is safe, so long as that man guards her doors," one guard says to another. Eavesdropping along the path to Gyoubu's battlefield can also reveal the best tactic to use against the deadly General.
Sekiro Boss Guide: How to Beat General Tenzen Yamauchi
First you'll need to get to Gyoubu the Demon.

After defeating General Tenzen Yamauchi and sneaking past the giant snake, you'll arrive at the Ashina Castle Gate Fortress Sculptor's Idol. Infiltrating the Ashina Castle gatehouse complex is a great place for stealth. It's possible to backstab Deathblow nearly every guard on your way to Gyoubu the Demon.
Keep an eye out particularly for a man mourning next to a dead horse. "All it took was a bit of gunpowder, he startled…" the man laments, before Sekiro inevitably drive a sword down through his shoulders and into his heart.

This is your hint: a Prosthetic Tool with gunpowder could be a major asset against Gyoubu. (Anyone who already has Shinobi Firecracker can skip this next section).
The Best Shinobi Prosthetic Tool Against Gyoubu
Gyoubu is a much harder fight without the Shinobi Firecracker, a Prosthetic Tool that Sekiro won't find during the normal course of the Shadows Die Twice campaign (at least not early enough in the game to be useful against Gyoubu).
For the Sculptor to build the Shinobi Firecracker, you'll need to provide him with Robert's Firecrackers, which can be purchases as merchant "Mobs" for 500 sen. Here's the problem: the first merchant on your path is found at the top of gatehouse staircases after beating Gyoubu.
But there's a way to get the Shinbo Firecracker Prosthetic Tool early. It begins at the Outskirts Wall - Gate Path Sculptor's Idol (or by backtracking from the Outskirts Wall - Stairway Idol.
Remember the guy with the cannon, who fires exploding mortars down on Sekiro? Kill him and look around from his vantage point on the ramparts. You should see a white icon, indicating a branch that can be Grappled.

From there, keep heading up the slope, to a cliff. Look up for the final Grappling Hook attachment point.

On top you'll find the Crow's Bed Memorial Mob, who will sell you everything needed to obtain the Shinobi Firecracker. Here's a more thorough guide to the Shinobi Firecracker.

Gyoubu the Demon Boss Battle
Riding out on his titanic steed, Gyoubu announces himself: "My name… is Gyoubu Masataka Oniwa!"
Even Sekiro is impressed, muttering, "So that's Gyoubu the Demon."

Gyoubu the Demon has a number of possible attacks with his long-reaching spear and horseback speed. Typically, he'll charge from a distance, delivering a swirling blow that's tricky to deflect, then bring his horse to a stop to throw additional spear slashes at you. He also has upward and downward slashes. Particularly deadly is a ground-smashing downward slash, though Gyoubu's long recovery time after makes it a good opportunity to strike a few blows. For these attacks, good dodges and deflections are key.
In addition to his charge and close combat tactics, Gyoubu the Demon also uses his spear in distance attacks, by swinging it out on a long chain. When Gyoubu starts swinging his spear in a circle, jump in close and look for the Grappling Hook icon. Closing the distance by grappling often opens a window where Sekiro can slash Gyoubu and his horse multiple times. This is also a good place to use the Shinobi Firecracker.
The Shinobi Firecracker causes Gyoubu's horse to rear up on its hind legs. From this position, Gyoubu can't attack and is at your mercy for a few seconds. Use the time wisely.
When Gyoubu is charging or circling Sekiro, it can be hard to land blows. Instead, it's better to either encourage attacks that the Grappling Hook can be used against, or staying in as close to Gyoubu as your Posture can endure, landing blows on his horse's flank, or using your limited Shinobi Firecracker to attack the horse's exposed stomach.
This means corralling Gyoubu into a corner and denying him the open space he needs to control the terms of engagement. This corner is an especially good place to fight Gyoubu:

Gyoubu the Demon and the Divine Grass
Divine Grass is a rare item, at least in the early game, but was essential to my eventual victory against Gyoubu the Demon. While certainly not necessary, I feel the need to disclose how I found this particular crutch, in case you missed it. It provided a crucial edge.
Divine Grass is, according to its item description, "a secret medicine that fully restores Vitality and cures all status abnormalities. One small part of Ashina is exceedingly old. The ancient soil, rocks, and water that pervaded the land are said to have attracted the attention of the gods. The doctor Dogen studied the plans in this ancient place, resulting in the recipe for this special medicine."
Only one Divine Grass is obtainable before Gyoubu the Demon and it can be found in a ruined tower just to the right of the gate leading to General Tezen Yamauchi (if you're facing up toward the gate on the staircase where you fought the Chained Ogre).

It's a bit of a circuitous route to get to that tower. Go up to General Yamauchi's courtyard and through the gates to the right. You'll find a warning about what's ahead. Grapple down below you, then look out for white lines on the cliff across from you, to which you can leap and Ledge Hang. One more leap and you're at the cave.
Inside the cave are two paths. Go to the right for a headless demon. I died of Terror within seconds of facing him. Best to come back later. To the right is a path up and out, which will eventually lead to the ruined towers, watched over only be a handful of poison-spitting lizards.
Beating Gyoubu the Demon

After beating Gyoubu a "Shinobi Execution" will be announced and you'll receive a memory from the battle, which can be used to permanently increase your Attack Power by one. The option to "Enhance Attack Power" by consuming Battle Memories will now be available at Sculptor's Idols. Enhancing Attack Power causes you to deal more vitality and Posture damage with each attack.
Consuming the Battle Memory also teaches you more about Gyoubu, who once led a group of infamous bandits and was defeated by Lord Isshin, who took him in as a Ashina warrior. "Oniwa would later go on to become Genichiro Ashina's most trusted retainer."
You'll also win a Mechanical Barrel, which can be given to the Sculptor to enable Prosthetic Tool Upgrades, a whole new skill tree. "A reinforced core is sure to make a shinobi's fangs even sharper," the description reads.
This is what that daunting new Skill Tree looks like:

Have fun.