In order for this to work, you need to add the layer (url) as part of your content as a "Dynamic Layer" like this http://webadaptor.domain.com/arcgis/rest/services/foldername/servicename/MapServer (Then give it a proper name) and not like this http://webadaptor.domain.com/arcgis/rest/services/foldername/servicename/MapServer/0 before adding it to a map in portal. See images below:
That is the way it works
If you mean the "field_name_0" then you need to remove that before publishing the layer by "double clicking (on the TOC in ArcMap) on "field_name_0", which will turn it into a textbox and removing it completely (press delete) then click out. See images:
I agree with Baba, if you are using ArcGIS server to publish the mapservice. But if you just add the url to a web map in the AGOL map viewer to build a web map then you do not get this option (at least I can not find a way). So the need to remove the classification field name in code becomes necessary. The issue is that the field name is part of the Legend portion of the LayerList widget and there is no particular class that can be used to get that exact dom element so you can set its css to not be visible. I will look into this further but it is not looking good.