The First Punic War began in 262 B.C, after a series of silly diplomatic failures.
The pre-text for the war was the occupation of the Sicilian city of Messana (now Messina) by a tribe of thugs called the Mamertines. The King of the Greek colony of Syracuse, named Hiero, wanted to return Messana to Greek control, so he sent his army north to attack the city. Defeated in the initial battle, he returned the next year (265 B.C.), taking the surrounding territory and laying siege to Messana. The Carthaginians, observing Hiero’s behavior and not wanting him to get too powerful, decided to get in the game. They sent a garrison to occupy the Messana after convincing the Mamertines they needed protection. No fools themselves, the Mamertines didn’t trust the Carthaginians, so they signed a treaty with Rome. The Romans, for their part, saw the value of an alliance designed to counter a Carthaginian threat to Italy.
Hiero promptly made a treaty with the Carthaginians, and they agreed to destroy Messana the next year (264 B.C.). The Romans got two legions to Messana in with great difficulty, after their rented ships had problems with the wind and tides. They raised the siege of Messana, scared Hiero back to Syracuse, and defeated the Carthaginians. Under pressure from Rome, Hiero sued for peace, which was granted, and he was required to pay a fine.
The Carthaginians decided they did not appreciate the aggressiveness of Rome so they prepared an army, placed it in Acragas, and sent their navy in support. Carthage had the best navy in the western Mediterranean at that time -- built out of the requirement to protect its trade routes with outlying colonies. No country was in a position to challenge the Carthaginian Navy.
In 262 B.C, the Romans laid siege to Acragas, officially starting a war that would last twenty-one years. After taking the city, the Romans leveled it. Both armies were exhausted and unable to prepare for battle until the next year, but the Romans now realized that driving the Carthaginians out of Sicily was going to be more difficult than they anticipated. They also knew their success was in doubt without a navy, so the Senate approved he funds for construction of war ships.
Rome had no coastline (60 miles inland), no navy, no merchant marine, and no history of trade or knowledge of sailing practice in the Mediterranean, yet they went ahead and built 500 ships in 60 days!
The new navy did not find a place in the war for five years, because the majority of the conflict was inland and all the navy could do was re-supply the army. Then in 256 B.C, the stage was set for the Battle of Ecnomus, where 330 Roman battleships were opposed by an equal number of Carthaginian vessels. The Romans formed their fleet in two large “Vs” with the second of them shielding transport ships. The Carthaginians formed a long line in an attempt to flank the Roman V, but in the midst of his success, the Punic commander chose to attack the transports rather than encircling the Roman warships. That left the Roman fleet free to counterattack and the Carthaginians were defeated.
The Romans would eventually win the war through a combination of sea and land power, but the initial success of the navy would not be repeated for years. The Romans had to learn how to fight on water, where the weather and wind can determine the outcome.