When someone visits your home in the afternoon, you can invite them to "stay for dinner". That means that they weren't planning on eating dinner at your house, but they did.
Here are some examples in sentences:
Why don't you stay for dinner?
Masa and Irene came over in the afternoon and ended up staying for dinner.