Device to device (D2D) communication that provides high data rate proximity based direct communication between users, along with simultaneous wireless information and power transfer (SWIPT) that extracts energy from the received RF power, can achieve high energy and spectral efficiencies together with low latency communication. Heterogeneous networks, that employ efficient frequency reuse, provide high gains in the coverage and capacity of the cellular networks. SWIPT helps in converting the harmful interference, incurred by the frequency reuse of D2D tier underlaying the Hetnet, into energy that can be stored for the future. This work presents a resource allocation and power control scheme for SWIPT enabled underlay D2D networks, designed to improve the energy efficiency and the amount of energy harvested while ensuring the minimum required data rates for the users. Resource allocation is performed using a stable many-to-one matching game model inspired from Gale-Shapley algorithm. Two techniques of SWIPT, namely power splitting SWIPT and time splitting SWIPT, are considered and the resource allocation schemes are designed for both. Simulation results demonstrate the superior performance of the proposed algorithm compared to an existing work in single tier network with power splitting SWIPT. The work is extended to a typical 5G HetNet scenario, and extensive simulations are done to compare the performance of the two SWIPT architectures in the HetNet scenario.