You use stray to describe something that exists separated from other similar things. An 8-year-old boy was killed by a stray bullet She shrugged a stray lock of hair out of her eyes
If someone strays somewhere, they wander away from where they are supposed to be. Tourists often get lost and stray into dangerous areas A railway line crosses the park so children must not be allowed to stray
If your mind or your eyes stray, you do not concentrate on or look at one particular subject, but start thinking about or looking at other things. Even with the simplest cases I find my mind straying = wander