Fetching details from the dictionary...

to happen to pass by
公園の前を通りかかったら桜が満開だった。
When I happened to pass by the park, the cherry blossoms were in full bloom.
公園の前を通りかかって、懐かしい景色を眺めた。
I happened to pass by the park and gazed at the nostalgic scenery.
たまたま通りかかっている人に道を尋ねた。
I asked for directions from a person who happened to be passing by.