Motivated by the swimming of sperm in the non-Newtonian fluids of the female mammalian reproductive tract, we examine the swimming of filaments in the nonlinear viscoelastic Upper Convected Maxwell model. We obtain the swimming velocity and hydrodynamic force exerted on an infinitely long cylinder with prescribed beating pattern. We use these results to examine the swimming of a simplified sliding-filament model for a sperm flagellum. Viscoelasticity tends to decrease swimming speed, and changes in the beating patterns due to viscoelasticity can reverse swimming direction.