To get the data between name=" and ", on the line after the line saying :literal data packet:, using sed:
gpg --list-packets file.gpg | sed -e '/^:literal data packet:$/!d' \ -e 'N' \ -e 's/[^=]*name="//' \ -e 's/",$//' \ -e 'q'
The sed expressions first deletes all lines read from gpg until it finds the :literal data packet: line. It then immediately appends the next line with N and removes everything now in the buffer up to and including the first name=" substring. It then removes ", from the end of the line and quits (outputting what's remaining in the buffer).
This allows us to handle filenames like file", or name="hello" embedded in the gpg data.
Note that special characters will be encoded as a hexadecimal escape sequence before they are embedded in the gpg file. For example, every newline character will be encoded as \x0a.