First embed $Y$ in $[0,1]^{A(Y)}$ by the map $i_Y:Y\to[0,1]^{A(Y)}:y\mapsto\Big\langle f(y):f\in A(Y)\Big\rangle\;,$ exactly as $X$ is embedded in $[0,1]^{A(X)}$ by the map $i_X$. An arbitrary point of $[0,1]^{A(X)}$ is simply a family of real numbers in the interval $[0,1]$ indexed by the functions in $A(X)$; I’ll denote such a point by $\big\langle r_f:f\in A(X)\big\rangle$. Similarly, an arbitrary point of $[0,1]^{A(Y)}$ is $\big\langle r_f:f\in A(Y)\big\rangle$.
Now define
$H:[0,1]^{A(X)}\to[0,1]^{A(Y)}:\Big\langle r_f:f\in A(X)\Big\rangle\mapsto\Big\langle r_{f\circ g}:f\in A(Y)\Big\rangle\;;$
for each $f\in A(Y)$, $f\circ g\in A(X)$, so this makes sense. Moreover, each projection $\pi_h:[0,1]^{A(Y)}\to[0,1]:\Big\langle r_f:f\in A(Y)\Big\rangle\mapsto r_h$ is easily seen to be continuous, so $H$ is continuous. You now have the following continuous maps:
$\begin{array}{c} &X&\underset{g}\longrightarrow&Y\\ &\;\;\;\;\;\downarrow i_X&&\;\;\;\;\downarrow i_Y\\ &[0,1]^{A(X)}&\underset{H}\longrightarrow&[0,1]^{A(Y} \end{array}$
Consider a point $i_X(x)\in B(X)$: $i_X(x)=\big\langle f(x):f\in A(X)\big\rangle$, so
$H\big(i_X(x)\big)=\Big\langle(f\circ g)(x):f\in A(Y)\Big\rangle=\Big\langle f\big(g(x)\big):f\in A(Y)\Big\rangle=i_Y\big(g(x)\big)\;.$
Thus, $H\big[i_X[X]\big]\subseteq i_Y[Y]$. Moreover, $i_X[X]$ is dense in $B(X)$, so $i_Y[Y]=H\big[i_X[X]\big]$ is dense in $H[B(X)]$. But $Y$ is compact, so $i_Y[Y]$ is closed in $[0,1]^{A(Y)}$, and therefore $H[B(X)]\subseteq i_Y[Y]$. That is, $H[B(X)]$ is a subset of the domain of $i_Y^{-1}$, so $G=i_Y^{-1}\circ H:B(X)\to Y$ makes sense and of course is continuous.
Now you have only to verify that $G\circ i_X=g$, which is straightforward.