I have a problem making a anvil and i cant seem to find the cause
I think that what you're calling "bad mesh" is the actual mesh without the influence of the subsurf modifier, while the "good mesh" is the result of the subsurf (and actually the result when rendered. When using the subsurf modifier, the vertices should be considered as "control points", which sometimes will not coincide with the rendered forms. To learn how to manage your control points and achieve the results you want, you should search for tutorials about "Hard surface modelling", in particular you'll have to get familiar with Edge control loops and edge crease. Lots of tutorials are available for free, like this: https://www.youtube.com/watch?v=nBkwodrQq_4.