The Raid on Lannisport was one of the opening attacks of the Greyjoy Rebellion, taking place approximately nine years before the War of the Five Kings. The Lannister fleet, docked at Lannisport was destroyed in an attack carried out by Euron Greyjoy, brother of Balon Greyjoy, who had crowned himself King of the Iron Islands.
Jaime recalls Euron burning the Lannister fleet at Casterly Rock (actually it took place in Lannisport), the very act which started the Greyjoy Rebellion, when he meets with Cersei to propose to her and form an alliance. Jaime goes on to recount how he killed many ironborn, which Euron is grateful of since the Iron Islands were "overcrowded" and how it led to Euron's exile which made him the "greatest captain of the fourteen seas," discomforting Jaime.
In the books
In the A Song of Ice and Fire novels, the attack on Lannisport was the first stage of the Greyjoy Rebellion, devised by Euron Greyjoy but carried out by his brother Victarion, Lord Captain of the Iron Fleet; he personally flung the first torch onto Tywin's flagship. That was, however, the only successful stage of the rebellion; from that point, the ironborn were repeatedly defeated until Balon surrendered.
The destruction of the Lannister fleet (which consisted of about twenty to thirty ships) gave the ironborn freedom to launch the next stage of the rebellion - an attack against Seagard - and raid the coastline.
Balon hoped that the destruction of the Lannister fleet would give the ironborn naval supremacy over the Sunset Sea, but was wrong; Stannis eventually defeated Victarion's Iron Fleet in a sea battle off Fair Isle, allowing Robert to invade the rebellious Iron Islands.
In the fourth novel, Euron spreads rumors about his past deeds, taking the credit for destroying the Lannister fleet as if he performed that himself, not just planned it.