When can I go swimming after having a hysterectomy?

Depends. That would be a good question for your doctor. It is not unsafe to get a surgical incision wet and swimming pools are chlorinated so infection risk is very low. Sanitation for the woman who is bleeding a bit after surgery may dictate some delay before swimming.
Six weeks. Obviously you would want to get a specific answer from your surgeon but about 4-6 weeks is a typical restriction to give the incisions time to heal.