My phone is Sony Xperia XZ1 Compact which has Adreno 540 as gpu. My laptop's gpu is NVIDIA GeForce 940MX 4GB which seems to be much worse than my phone's gpu. My PC's OS is Ubuntu 16.04.
No. Your phone's GPU is in one chip with the CPU, some of the memory, and its display controller, and they're all tightly integrated together. Also, there'd be no way to connect it efficiently to the laptop. Only the latest generation of USB and Thunderbolt have enough bandwidth to be even worth considering for external GPUs, and even then, they're only used with dedicated hardware at the GPU end of the link - not a general-purpose processor. Apart from the fundamental problems, there's the very practical issue that your PC doesn't have any drivers for the GPU on the phone.
I know mobile GPUs are pretty effective, but if your phone's GPU seems faster than the Nvidia chip in your laptop, there's something wrong with your laptop. If you can give more information on the problem to the people at Ask Ubuntu, they can probably help with that.