I’m also not a D&D player so the rules were new to me as well, but yes you need to forget a spell to learn a new one.
Then you can’t use it but next time you level up you can re learn it (forgetting another one) or I believe also learning it as the new spell.