Are the people at the job nice? Do you have freedom to work as you please? Do you have the time to take the code in a better direction? I'm just trying to help you find a bright side.
I'd say there are two possible paths here. Either the job is overwhelming to you, or it's not overwhelming but just extremely unpleasant. If it's overwhelming, I'd say to explain that to your manager and request an immediate short-term re-assignment. If it's just unpleasant, then follow your manager's advice. You might be holding your nose for a while, but you will adapt to it and it will get easier.