Help with Moving to Sweden

Hi, I'm from America and I'm wondering how long it would take to apply for a residence permit?

Me and my boyfriend (who lives in Sweden) have met before and would like to be together, we haven't gotten married and I was wondering how long this process could take?

I'm really anxious because he's going to be studying soon and I would also like to study in Sweden. I would like to get help with this process since I'm super anxious :(
I would like to get a student visa for the Qualifying Course in Swedish or something I would love any kind of ideas or if someone could walk me through this it'd be very helpful :)

https://www.migrationsverket.se/English/Startpage.html

Go to this link and select apply for permit. There are two options that you can consider, permit for studies and permit for living with someone. In both cases requirements etc are described on the page. You'll get a good idea of what you need to do from there. For student visa, you need to be accepted for a course by university first.