The personnummer (personal number) is the key to all Swedish bureaucracy. It is not only your tax ID and your social security number. It is also used for the citizen registry and in many other applications.
When arriving in Sweden, applying for your personnummer should be among the first things you do.
Why is it so important
Well, first of all: you must have one if you are a permanent resident of Sweden.
Without one, you simply don't exist in the system. Health care, taxes, pensions - everything is organized using this number. Banks and telephone companies assign their contracts to the personnummer of the customer.
The address database of the citizen registry is also used by these companies. When moving inside Sweden, changing the address in the registry will update the addresses at your bank etc. automatically.
For most bostadskös in the province it is a requirement to have a personnummer.
Be careful: though the Swedish system is very open - all addresses and tax returns are public - the personnummer should not be passed on thoughtlessly. It is a very powerful number, as you can imagine, and should not be in the hands of somebody who can make trouble with it.
How does it look like
It looks like this
or, more common, like this:
The first part stands for the person's birth date (year-month-day format as it is common in Sweden). The three following numbers are assigned after availability. Men get odd numbers, women even numbers. The last digit is a checksum so that mistakes in typing in the previous digits can be avoided easily.
Who gets one
The personnummer is assigned by the Swedish tax authority Skatteverket. To be eligible your expected length of stay must exceed 12 months.
In principle there should be checks if everything is in order. It is rumored however that there is little done to enforce it. Immigration issues are the responsibility of Migrationsverket, and so Skatteverket does not bother much.
How to get one
You can only get one by applying in person at one of Skatteverkets offices. The easiest is probably to go to the service office in Stockholm city, located in Klara Västra Kyrkogata 13, just around the corner from the central station.
Here is a list of all Skatteverket offices: 
No matter where you go: go early. The average Swede has virtually never the need to go there in person. Therefore it is crowded with people who are either foreigners or have exotic cases to solve. That takes time.
Bring in any case your passport and other relevant papers to spare you a second visit.
A samordningsnummer serves as a personnummer replacement for those who are not eligible. It is e.g. used as a tax ID if you have a holiday house in Sweden. This is also its main purposes as it is little useful in other contexts.
The reason for that is quite simple: it uses a YYMMXX-AAAB scheme and looks like personnummer at first sight, but XX is the day of birth plus 60. Thus, the birth date in this "personnummer" is always a non-existing one, which may cause difficulties when trying to use it for non-official business.