The app doesn't decide which community to post in; you do. When you pick a community for the post to go to, you might pick !news@beehaw.org, in which case it becomes hosted by the beehaw.org server. Or you might pick !news@lemmy.world, in which case it's hosted by the lemmy.world server. If you vote or comment on the post that's on beehaw.org, the vote/comment is hosted there as well, and likewise for lemmy.world.
The app doesn't decide which community to post in; you do. When you pick a community for the post to go to, you might pick !news@beehaw.org, in which case it becomes hosted by the beehaw.org server. Or you might pick !news@lemmy.world, in which case it's hosted by the lemmy.world server. If you vote or comment on the post that's on beehaw.org, the vote/comment is hosted there as well, and likewise for lemmy.world.
Perhaps the important point is that !news@beehaw.org and !news@lemmy.world are different communities, just like how neo@thematrix.com and neo@zion.org are different email addresses, even though they're both Neo.