I chose the WienerProcess
as the underlying random process, as this will simulate a Brownian motion.
Until Boundary Hit
Module[{rd = Transpose @ RandomFunction[WienerProcess[], {0, 1000, .01}, 2]["States"], length},
length = LengthWhile[rd, # \[Element] Rectangle[{-2, -2}, {+2, +2}] &];
ListPlot[rd[[;; length]], Joined -> True, Mesh -> All, PlotRange -> {{-2.5, 2.5}, {-2.5, 2.5}},
Epilog -> {EdgeForm[Thick], White, Opacity[0], Rectangle[{-2, -2}, {+2, +2}]}, ImageSize -> Large]
]