Two-handed weapons give you a free hand when not attacking
It's important to remember what the weapon properties actually do. Heavy weapons are just too big for a small character to use effectively; for a medium character, that property is entirely meaningless.
I think "two-handed" is what you're thinking of:
Two-Handed. This weapon requires two hands when you attack with it.
Note what it does NOT say there: It doesn't say you need two hands to hold the weapon, only to attack with it.
A perfect example is the shortbow. Consider how a bow is used: You easily carry it in one hand and you have your other hand free to do things. When you decide to shoot an arrow, you need both hands on the bow for a few moments, but as soon as the attack is done, your hand is free again.
Yeah, some of the biggest two-handed weapons are close to 20 pounds, which is a lot to one-hand, but most of them are much lighter than that, and what you're talking about is making a melee attack, then taking your free hand off for a few seconds to draw and throw a weapon. There's no reason that shouldn't be possible.
From both an in-universe and a game-rules perspective, there's no issue at all with doing this, no need to stow your greatsword before you draw and throw an axe or javelin.
It's worth noting that this is why two-handed weapons are very popular with gish characters (that is, melee-spellcasting hybrids) such as Eldritch Knights and Paladins. A two-handed weapon allows them to instantly switch between attacks and spellcasting essentially at will.
Don't worry too much about it
That said, I've never found much benefit in being hard-nosed about tracking the number of interactions involved in switching weapons. There may be some tactical interest in having to think about whether it's worth your time to stow a melee weapon to switch to ranged if the enemy is likely to close with you next turn (which might push you to do something different, like Dodge or Ready), but in most cases if a player wants to, say, put away their bow and pull out two daggers in the same turn, I'm not going to make a fuss about that even though it's technically three object interactions. Combat in 5e tends to be pretty fast and vicious, so as a DM, I'm very invested in the idea of my players getting to do something cool or interesting every turn. It's no fun to hear "no, sorry, you can't do that, it'll take your whole action to put away your bow and draw one sword, you can get the other one out next turn"; at least for me, that feels like bookkeeping getting in the way of the fun. (I'm not completely without limits -- I just tend to consider "switch weapons" to be one interaction regardless of how many individual objects we're talking about. If you already switched from sword to bow at the start of your turn, you can't then switch back at the end of your turn!)