1. I happened to meet he on the sidewalk.

2. I chanced to meet her on the sidewalk.

3. I met her on the sidewalk by chance.

4. I met her on the sidewalk by accident.

5. I met her on the sidewalk by happen.
-------------------
Are they all the same in meaning? What about #5? Is it grammatical?

2 answers

#5 is not really grammatical...i suppose.Rest of these are approximately same but not actually.
1 is correct IF you mean "her" instead of "he."

2, 3, 4 are correct.

5 is not correct.