If the layer is locked, when you erase something in that layer, it changes to the background color. (default BG color is white)
When the layer isn't locked, the background and foreground are transparent, so the layer underneath shows through, or it just becomes transparent.
Also, if you're trying to accurately render something the eraser tool is your worst option.
If the background you're trying to remove is a solid color you can use the "Color Range" option (Select > Color Range). On top of that you should start using the pen tool to select details.