Arduino Mega + Esp8266

@ozbayalperen1 this is why we ask you to post picture.from your connection it look like you are connecting your esp to serial and not to serial1.
so change the pins.