An ellipse is a figure such that the sum of the distances from a point on the graph to the two foci is a constant. A hyperbola is a figure such that the differences of the two distance from a point to the two foci is a constant. The fact that that constant is "2a" comes only after you write the ellipse as
\frac{x^2}{a^2}+ \frac{y^2}{b^2}= 1
or
\frac{x^2}{b^2}+ \frac{y^2}{a^2}= 1
with a the length of the "major semi-axis" so that 2a is the distance between the two vertices along the longer axis.
To see that, set up and ellipse with major axis along the x-axis, center at (0, 0). Then the two foci are at (f, 0) and (-f, 0), the vertices along the line between foci are at (a, 0) and (-a, 0). The distance from vertex (a, 0) to the focus (f, 0) is a- f. The distance from that vertex to the other vertex is a from (a, 0) to the center, (0, 0), is a, of course, then the distance from (0, 0) to the other focus, (-f, 0), is f for a total distance from (a, 0) to (-f, 0) of a+ f. The total distance from (a, 0) to the two foci is (a- f)+(a+ f)= 2a. Given that that sum of distances is a constant, that constant must be 2a.
Similarly the constant for the hyperbola is 2a only after you write the hyperbola as
\frac{x^2}{a^2}- \frac{y^2}{b^2}= 1
or
\frac{y^2}{a^2}- \frac{x^2}{b^2}= 1
with a the distance from the center of the hyperbola to s vertex.
Of course, the difference between an ellipse and a hyperbola is that the foci of an ellipse are inside the vertices while for a hyperbola, they are outside.
Again, set up the hyperbola so its center is at (0, 0), its vertices are at (-a, 0) and (a, 0), its foci at (-f,0) and (f, 0). The distance from (a, 0) to (f, 0) if f- a (the foci are now outside so f> a). The distance from (a, 0) to (-f, 0) is the distance from (a, 0) to (0, 0), a, plus the distance from (0, 0) to (-f, 0), which is f. The distance from (a, 0) to (-f, 0) is a+ f. The difference of those two distances is (a+ f)- (f- a)= 2a.