Canvas resolution depends on window size and other factors, it will always be different from the object size. (And different for each user!) See the documentation:
If you need the resulting PNG to be exactly 500x500 px, you will need to resize the canvas first. For example, in your case I think the canvas size needs to be ~ 419x419 px. Use DrawingCanvas.PixelScale expression to calculate the canvas object size, then draw the image on it, then save the PNG.