Salah, who has not been at his best since returning from injury last month, was brought on in the 79th minute, just after the Hammers' second goal levelled the game
Giroud, making a rare league start, put Arsenal ahead in the 37th minute when he stabbed home from close range after Mesut Ozil's header deflected into his path.
Second-half own goals from Jack Cork and Kyle Naughton, both coming via deflections from shots by Alex Iwobi, put the game out of Swansea's reach before Alexis Sanchez volleyed home in the 73rd minute to wrap up the win.
The victory lifted Arsenal provisionally into third place on goal difference above Liverpool, who play Manchester United at Old Trafford on Sunday.