4. As shown in Figure 1, in $\triangle A B C$, $\angle C=90^{\circ}$, $A C=2$, $B C=1$, points $A$ and $C$ are on the $x$-axis and $y$-axis, respectively. When point $A$ moves on the $x$-axis, point $C$ moves on the $y$-axis accordingly. During the movement, the maximum distance from point $B$ to the origin $O$ is ( ).
(A) 3
(B) $\sqrt{2}+1$
(C) $\sqrt{5}$
(D) 2
4.B.

As shown in Figure 6, take the midpoint $D$ of $AC$, and connect $OD$, $BD$, $OB$. It is easy to see that $OD=1$, $BD=\sqrt{2}$. Since the shortest distance between two points is a straight line, i.e., $OB \leqslant OD+BD=1+\sqrt{2}$, thus the maximum distance from point $B$ to the origin $O$ is $\sqrt{2}+1$