This may sound confusing, but it's simple once you break it down. The core difference between brandy and cognac is that cognac is classified as a subtype of brandy.
Brandy is a spirit made from distilling wine. Typically, wine is fermented from fruit, where yeast is used to convert the naturally occurring sugar in the fruit into alcohol.
Cognac is made in the Cognac region of France using grapes from Cognac (Monfils, Ugni Blanc, Colombard, Folignan, and Folle Blanche) and aged in French barrels.
As long as it comes from Cognac and follows the rules for cognac, a variety is still cognac. Unlike brandy, it's not sweetened and generally clocks in at around 40% ABV.