Macports and Xcode

You can uninstall MacPorts using their official instructions:
https://guide.macports.org/chunked/installing.macports.uninstalling.html

sudo port -fp uninstall installed
sudo dscl . -delete /Users/macports
sudo dscl . -delete /Groups/macports
sudo rm -rf \
    /opt/local \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0 \
    ~/.macports

Now MacPorts is removed, you can install Gimp without MacPorts using a regular installer from their website: from https://www.gimp.org/, choose Download, then Download Directly.