"Oh, my goodness, you finally came. We had waited for you for a long time."
Is "came" grammatically correct here?
Should we say "Oh, my goodness, finally you come" instead when we see our friend coming finally?
Thanks for your help!
"Finally you came!" is fine. You could also say "You have finally come!" I slightly prefer the latter. "Finally you come" is incorrect.
For the second half, "We have been waiting for you for a long time!" is better.
Remember - if you don't use correct capitalisation, punctuation and spacing, anything you write will be incorrect.