tar -x will extract the contents of the *.tar.* file to the present working directory... Period. That being said, here's what that means, and how we can work around that to get the behaviour you want.
Usually, a directory is tarballed. Meaning someone wrote:
tar -czf tarball.tar.gz somedirectory
In that case, if you tar -x it you'll get the contents extracted to somedirectory. However that's only by convention. It's very possible for someone to compress an archive with:
tar -czf tarball.tar.gz file1 file2 file3
In that case, when you tar -x, you'll get file1, file2, and file3 in the current directory.
In this situation, if you want to keep the extracted files in an isolated directory, you should:
mkdir tarball && cd tarball && tar -xzf ../tarball.tar.gz
To understand if you should tar -x or mkdir _ & cd _ & tar -x ../_, you can use tar --list -f tarball.tar.gz. This will list the contents of the tarball before you extract it so you can decide if you want to extract it to pwd as-is, or create a new directory and extract it from there.