It comes from the unit circle definitions.

Unit circle - Wikipedia, the free encyclopedia

The sine of the angle is the length of the perpendicular - and I believe "sine" is Greek for "perpendicular".

The cosine of the angle is the length of the horizontal - it's so named because this length changes in conjunction with the change in the sine value...

The tangent of the angle is the length of the vertical tangent.