I'm trying to erase part of an image, but every time I apply the eraser tool a stroke appears like the circle of the eraser tool.
I think what you're referring to, is erasing parts of a path... which creates anchor points to subtract from the shape, if that's the case;
That is how the eraser tool works.
Note, it doesn't actually create a stroke, but rather it removes an area from the shape in the way of a stroke since you are "erasing" [GIF]
Another way to "erase" part of a shape is to use the Pathfinder tool. Make a shape, like a square, or any other shape, and place it above the shape you want to erase. Then select both shapes, and choose the Minus Front button in Pathfinder, and it will erase the bottom shape using the overlap of the top shape. It will make more sense once you try it.