Powering ESP32 using Arduino Mega

Hello,

I need to use the wifi capabilities of the ESP32 WROOM board for my project, and was wondering if I could potentially supply the board through my Arduino Mega, which runs off a power supply wall socket of 12V and 0.5A.

Thank you.

No, absolutely not.

Do you mind telling me why this is the case?

As a general rule, never think of any controller board as a power supply.
In Your case the Mega 5 volt converter will get overloaded and damaged/destroyd.
It does not produce the current needed and will be overheated.