Converting PEM to PKCS12 using intermediate certificate

You need to concatenate all the PEM files into one, then convert it to PKCS#12:

$ cat certificate.crt intermediate.crt > bundle.crt
$ openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in bundle.crt