I'm building a Hexblade Warlock from level one. This pretty much requires you to have a sword and shield. How is it possible for me to cast my spells without my hands open?
In short... you can't right away.
A Hexblade (XGE p55) warlock cannot fight sword-and-board full-time from level one, unless you restrict yourself to purely verbal spells (of which the Warlock has very few). The character will need to put away the sword on spellcasting rounds using the one free object interaction.
If a Hexblade takes Pact of the Blade as their Pact Boon at L3, they become eligible for the Improved Pact Weapon invocation and can swap out one of the invocations selected at L2. From that point, they can keep their weapon and shield in hand at all times, using the weapon as a spellcasting focus.
Unless you're a variant human...
...and even then, you have to check on a spell-by-spell basis. Variant humans give up the across-the-board stat bump in favor of a feat (and some other benefits) at first level.
The War Caster feat (PHB p170) allows you to cast spells with Somatic components with your hands full. If the spell needs Material components, you'll still need to put the sword away to get at your component pouch or focus item.
Or have some help...
The Ruby of the War Mage, a Common attunement-required item from Xanathar's Guide to Everything can turn any weapon into a spellcasting focus. Despite the item's name, it is not specifically an arcane focus - it can be used by any class.
Option 1: Be a Variant Human, and choose Warcaster (PHB 170) as your starting feat.
Option 2: Be ready to juggle your items, drawing and stowing with forethought, until you get to 4th level and pick Warcaster.
Option 3: Shift (at least to start) more towards offense than defense, and use a two-handed weapon, This does more damage, and while you need two hands to wield it, you can hold it in one hand to cast spells. Although this will cause you to give up the ability to use you Charisma modifier, instead of strength, for the attack and damage rolls.