HornetQ is a Enterprise Grade JMS Messaging System.
JBoss ESB is a Enterprise Service Bus technology that can make use of a JMS Messaging System.
In the case of JBoss there is a bundled technology platform called JBoss SOA Platform that includes an installation of JBoss ESB and HornetQ Messaging into JBoss EAP 5.1.
In short: HornetQ doesn't use JBoss ESB. JBoss ESB can use HornetQ but its not required.