In functions, "Y" is generally used in place of f(X) to represent the output of the function. This output is dependent on the value of the input, which is represented by "X." In graphs, "Y" represents the vertical axis and "X" represents the horizontal axis.
Essentially, "X" and "Y" are just arbitrary letters that mathematicians use as regular placeholders in equations to make things more consistent. This allows mathematicians to communicate with one another easily. The notational standard ensures that X = 3Y - 2 can't be confused with the functions Y = 3X - 2 and Y = (X + 2)/3.