Direct transfer from HeartGold (Gen IV, DS) to Black (Gen V, DS) is impossible due to generational and hardware barriers (no DS-to-DS transfer for Gen IV→V). However, you can move Pokémon indirectly via Pokémon Bank (3DS app, requires Nintendo Network ID, active Bank subscription, compatible 3DS/2DS):
A friend with Black 2 or White 2 can use the Poké Transporter to move your HeartGold Pokémon into their game, then trade them to your Black cartridge via local wireless.
Note: Pokémon Bank and Poké Transporter are no longer purchasable (eShop closed March 2023) but remain usable for existing subscribers. Gen V games (Black/White) cannot directly receive from Gen IV without Bank/Transporter.