MacPorts is a source-based package manager. That means that each time you install a package via MacPorts, it downloads the source, potentially patches it, configures it, builds it, installs it to a temporary location (so it can track which files the port needs), makes an archive of it, then installs that archive into the MacPorts root, which is usually /opt/local. 
If you want to look at or edit the source before building it, you can execute a subset of the steps necessary to download and install it. port extract <name> will download and extract the source for the port, without actually building or installing it. You can then find the extracted source with port dir <portname>:
$ sudo port -v extract zlib
Password:
--->  Fetching zlib
--->  Verifying checksum(s) for zlib
--->  Checksumming zlib-1.2.3.tar.bz2
--->  Extracting zlib
--->  Extracting zlib-1.2.3.tar.bz2
$ ls $(port dir zlib)
Portfile    files  work
$ ls $(port dir zlib)/work
zlib-1.2.3
$ ls $(port dir zlib)/work/zlib-1.2.3
ChangeLog   as400  examples inftrees.h uncompr.c
FAQ  compress.c gzio.c  make_vms.com win32
INDEX    configure infback.c minigzip.c zconf.h
Makefile    contrib  inffast.c msdos  zconf.in.h
Makefile.in crc32.c  inffast.h old  zlib.3
README   crc32.h  inffixed.h projects zlib.h
adler32.c   deflate.c inflate.c qnx  zutil.c
algorithm.txt   deflate.h inflate.h trees.c  zutil.h
amiga    example.c inftrees.c trees.h
See the MacPorts guide for more information on developing ports, and also man port.