The option variable expand_polynomials is defined in hyp.lisp, but it is not documented. The source code says "When NIL do not automatically expand polynomials as a result"
Likely, the option variable should be renamed something like expand_orthogonal_polynomials.
Since the legendre_q functions aren't in general polynomials, it's unclear how expand_polynomials should interact with legendre_q, but I suggest that the following is wrong:
(%i5) trace(legendre_q);
(%o5) [legendre_q]
(%i6) specint(t*bessel_y(0,t)*exp(-t),t), expand_polynomials : false;
1" Simp "legendre_q[1,psey/sqrt(psey^2+1)]
1" Return "legendre_q(psey*sqrt(psey^2+1)*log((psey/sqrt(psey^2+1)+1)/(1-psey/sqrt(psey^2+1)))-2*psey^2-2)/(2*psey^2+2)
1" Simp "legendre_q[2,psey/sqrt(psey^2+1)]
1" Return "legendre_q((2*psey^2-1)*log((psey/sqrt(psey^2+1)+1)/(1-psey/sqrt(psey^2+1)))-6*psey*sqrt(psey^2+1))/(4*psey^2+4)
(%o6) -((sqrt(2)*log((1/sqrt(2)+1)/(1-1/sqrt(2)))-4)/(4*%pi))
The result should be expressed explicitly in terms of the legendre_q function.