Answer:
The strain of the swine flu that pigs get is just a virus that has always been around causing disease in pigs, just like humans have always had different viruses that infect them, like the common cold, stomach flu (viral gastroenteritis), and other viral infections. There really is no reason for swine flu, it's just that the pig is a carrier for this disease and that is how the name "swine" flu came about. It is also called pig flu and hog flu.
The Pandemic "Swine Flu", now called Influenza A-H1N1/09 Virus or the H1N1 Pandemic Flu, is able to infect pigs and humans. This is what has made it different, new, and potentially so much more contagious and one that could be more deadly because it is new and we have no prior exposure to have created immunity.
Usually, animal diseases cannot be passed on to humans and vise versa (like when you're sick and your dog or cat sleeps with you all day and does not get sick), but there is an exception for diseases such as swine flu and a handful others. These diseases are called zoonotic diseases. According to the World Health Organization (WHO), there are a little over 200 zoonoses that have been discovered, the several strains of swine flu being amongst them.