The fire was likely to have been started by two bare wires touching in a piece of location equipment, the UK Air Accidents Investigations Branch said.
It then spread through the cabin and burnt through the fuselage.
Investigators recommended tighter testing and certification of devices.
The fire on the Ethiopian Airlines Dreamliner closed down Heathrow for nearly 90 minutes on 12 July 2013.
The piece of equipment that caught fire - the Emergency Locator Transmitter (ELT) - was located near the back of the plane, and was made by Honeywell, investigators said.
The battery-powered transmitter is designed to detect unusual deceleration, such as the force produced by a crash, and to transmit a distress signal.
The device in the 787 had positive and negative cables that were too long to fit into the box housing the device, and so ended up touching one another.
Testing had predicted that the worst reaction from a short circuit would be the batteries running down.
Unfortunately, what actually happened was what investigators called "a thermal runaway" - a fire that spread from one battery cell to the next.
On the ground, the skin of the aircraft was pierced by the heat and the flames.
Fire in the air?
The location of insulation near the device allowed the fire to spread, investigators said.
However, had the aircraft been in the air, the outside of the aircraft would have been cold enough to limit how the fire spread.
Cabin crew would have had difficulty locating the fire, as the device is located behind panels.
The fuselage would probably have remained airworthy had the fire happened during a flight, but cabin depressurisation would have been a possibility.
The toxicity of the fumes was unknown, they added.
But the BBC's Jonathan Sumberg says the Dreamliner was built with carbon composite materials which, when burnt, give off toxins.