The KmlLayer renders KML elements into a Maps API V3 tile overlay.
If you want to display an existing KML file using Google Maps API you can try something like this:
function initialize() {
var location = new google.maps.LatLng(41.875696,-87.624207); // Chicago
var mapOptions = {
zoom: 11,
center: location
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var ctaLayer = new google.maps.KmlLayer({
url: 'http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/cta.kml'
});
ctaLayer.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
The full working example with HTML + JavaScript can be found here.
For more details see the KmlLayer Maps API Reference.