Cognac is a brandy but not every brandy is a cognac. Brandy is a spirit made from grapes. But only a brandy that has been made in the Cognac region (Charente) and that has been distilled twice (double distillation) is allowed to be called cognac.
There are other requirements that have to be met before a brandy may be called a cognac like the type of grapes that can be used, production methods that must be followed and some other.
Some brandies are (illegaly) called cognac. These are made in countries that have not signed the Treaty of Madrid, like some Asian countries.