Swine flu is caused by the H1N1 virus, a subtype of the influenza A virus. It originated in pigs but has the ability to infect humans. The virus is a reassortant virus, meaning it contains genes from multiple influenza viruses, including those found in pigs, birds, and humans.