I’m starting to play as Hexblade warlock and I have some kind of a brain lag. Can I wield a sword and cast spells with my free hand? Since my sword can be a spellcasting focus and I can perform somatic components with my free hand?
Yes and you don't even need the free hand if the spell requires both material and somatic components
From Somatic components
Spellcasting gestures might include a forceful gesticulation or an intricate set of gestures. If a spell requires a somatic component, the caster must have free use of at least one hand to perform these gestures.
From Material components
A spellcaster must have a hand free to access a spell’s material components — or to hold a spellcasting focus — but it can be the same hand that he or she uses to perform somatic components.
(all emphasis mine)