By 1915, the Western front was already being seen as a bloody stalemate. Instead of throwing more men at the German lines, the Gallipoli campaign aimed to open up a new front on the southern border of the Austro-Hungarian Empire. The thinking was that the army might be able to (a) knock the Ottomans out of the war with a quick attack, (b) allow Britain to send war supplies to Russia via the Black Sea, which was a much safer route than going through the North Sea to St Petersburg, and (c) open up a new front that would drain manpower and morale from the enemy, as their homelands were directly threatened. In short, the Gallipoli campaign was an attempt to win the war without throwing away more lives on the Western Front’s trenches, which is why it was such an attractive idea.
The Italy campaign was similar. Italy was Germany’s ally, but was widely known to be weak. The thinking went that an Italian campaign could (a) knock Italy out of the war, which it did, (b) force Germany to spread its forces out more widely, instead of concentrating them all on French and Belgian beaches (the Normandy invasion was already being planned by this point, so spreading out enemy forces would help make that future invasion more successful), and (c) give the Americans their first real fighting against the Germans, to learn their strategy. It would also serve as a dry run for a massive amphibious landing in Europe, which would serve as a learning experience for the later invasion of Normandy.
Gallipoli failed, and the Italian campaign didn’t go as quickly as hoped, but the underlying strategy and idea behind both attacks was not specious or especially terrible. Gallipoli was an unmitigated disaster, but had it been planned better or executed more precisely, who knows. Just because an attack failed doesn’t mean the idea was fundamentally flawed.