The application will be installed on the C drive, but the music library can be stored anywhere else you want to.
There is no direct method to extract music from an iPhone, so your best bet is to copy the music from your old Pc and place it on the D drive on the new computer, then install iTunes and import it into it.
Otherwise, you'll need to get a 3rd party app like iMazing or iExplorer to extract the music from the iPhone, iTunes won't do it.
Once iTunes is installed, hold the shift key while opening iTunes and it will offer the option to choose a library or to create one.
Choose Create Library and navigate to where you want to save the library on the D drive.
With the library opened, go to the File Menu ➜ Import, and navigate to where you saved all the music files and select the folder to import everything.
Once everything is imported, iTunes will keep the music on the D drive while the app lives on the C drive.
See the following user tip for more details.
click here ➜ Move your iTunes library to a new computer - Apple Community