\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather}
A = \underbrace{\frac{B}{C}}_{\substack{\text{comes}\\\text{from }X}} +
\underbrace{\frac{D}{E} + \frac{G}{H}}_{\substack{\text{comes}\\\text{from }Y}}
\end{gather}
\end{document}