You can store files on your Pi file system anywhere you have permissions. If you are not root, then typical places are your home directory, directories and sub-directories you create from your home directory and ... the /tmp directory. Note that /tmp will be erased on reboot.
If the file is an installation image or some other media that you wish to extract and install, I would suggest downloading and extracting to /tmp and extract there. To extract a .tar.gz file, you can run:
tar -xvzf <filename>.tar.gz
(see also: https://askubuntu.com/questions/25347/what-command-do-i-need-to-unzip-extract-a-tar-gz-file).
As for installing a downloaded and extracted package, that will usually vary based upon the nature of the package. You may want to see if the package is also available for
apt-get download and installation.