Is swimming a good idea if you have a torn ligament in the knee?

Yes. Doing low impact exercise like swimming or biking is important. Go easy the first time in the pool. Especially getting in and out of the pool. Also only do flutter kick. No breaststroke kick the first time. Breaststroke kick puts some torque through the knee.
Swimming is. Always a good idea....Have you discussed this with your doctor? Swimming is non weight bearing so it is ideal for orthopedic injuries and recovery. If you have pain when you use the knee swimming, then no. For gentle exercise an mobility, yes.