ESB is primarily used for integration of heterogenous applications. It is more like an integration infrastructure.
An ESB supports governance, message translation, routing. It incorporates the JBI (the java business integration spec)
ESB is a key feature of the SOA stack. Where you have rich UI communicating to web services, you have a BPEL engine for orchestrating the web services. The message routing and translation between the source and the target application will be handled by the ESB.
mule is a good open source ESB. You can check out the site mule.org to download and work on samples.