There's a lot of room for DM discretion, and such DM discretion is explicitly called out in the rules.
Other Activity on Your Turn:
The DM might require you to use an action for any of these activities when it needs special care or when it presents an unusual obstacle.
Improvising an Action:
When you describe an action not detailed elsewhere in the rules, the DM tells you whether that action is possible and what kind of roll you need to make, if any, to determine success or failure.
Since the specific object interactions a character could potentially want to accomplish are limitless, they can't all be covered by rules. Some guidelines for a DM might include how much time the action takes, how difficult it is, whether failure is even possible, and whether failure matters. That is, if there is no penalty for failure, just let the character succeed.
This is probably best illustrated by looking at the two examples you offer.
Throwing an object to a friendly creature, preventing the BBEG from taking it
In this case, failure seems possible, in that you could throw it poorly so that your ally can't possibly catch it. If your ally is right next to you, "hand an item to another character" is specifically called out as a free interaction. If the BBEG is on the other side of the room and your ally is within a reasonable distance (10 feet? 20 feet?), maybe you can toss the object casually and still attack or take another action. But if you are within reach of the BBEG, it becomes reasonable to say that you must focus your attention on the action of throwing the object while defending yourself from possible attack.
Furthermore, the action could require an Athletics check or an attack roll. It would probably also use the Reaction of your ally to catch it.
You might implement this differently. I don't see any rules that specifically cover this case.
You want to hurl something in frustration out to sea
This seems like a free object interaction. If it's OK to throw wildly, it doesn't require aim or focus. Specific circumstances might change this, like if you have to throw it some minimum distance, i.e. if throwing it out to sea means throwing it over the edge of a cliff which is 60 feet away. BTW, I would definitely model this as an Athletics check rather than an attack roll.
But, again, I don't see any rules that specifically cover this case.