Learning Subsystem Dynamics in Nonlinear Systems via Port-Hamiltonian Neural Networks