4. As shown in Figure 1, in trapezoid $A B C D$, $A D / / B C$, $A D \perp C D, B C=C D=2 A D, E$ is a point on $C D$, $\angle A B E=45^{\circ}$. Then the value of $\tan \angle A E B$ is ( ).
(A) $\frac{3}{2}$
(B) 2
(C) $\frac{5}{2}$
(D) 3
4.D.

As shown in Figure 6, extend $DA$ to point $F$ such that $AF = AD$, and connect $BF$. From the given information, quadrilateral $FBCD$ is a square, hence $BF = BC$.

Extend $AF$ to point $G$ such that $FG = CE$, and connect $BG$. Then, Rt $\triangle BFG \cong$ Rt $\triangle BCE$. Therefore, $BG = BE$, and $\angle FBG = \angle CBE$. Since $\angle ABE = 45^{\circ}$, it follows that $\angle CBE + \angle ABF = 45^{\circ}$.
Thus, $\angle ABG = \angle FBG + \angle ABF = 45^{\circ}$. Hence, $\triangle ABG \cong \triangle ABE$, $\angle G = \angle AEB$, and $AG = AE$. Let $CE = x$, $BC = 2a$, then
$$
\begin{array}{l}
FG = x, AF = AD = a, \\
AE = AG = x + a, DE = 2a - x .
\end{array}
$$

In Rt $\triangle ADE$, we have
$$
(x + a)^{2} = (2a - x)^{2} + a^{2}.
$$

Solving for $x$ gives $x = \frac{2a}{3}$.
Therefore, $\tan \angle AEB = \tan G = \frac{BF}{FG} = 2a \times \frac{3}{2a} = 3$.