If you will be in Sweden for more than three months and you are not an EU citizen, you need a residence permit.
You will find information on the different types of visas that you apply for:
A residence permit to move to a close relative in Sweden
A residence permit to study in Sweden
A work permit