Heya, being a big fan of Resident Evil, I would love to assist you. Although I never was a fan of Metal Gear, I did play some of the main series games so I may be able to help with that too. For starters, lets look over Resident Evil.
You would want to play the RE games in this order, regarding the storyline:
1.) Resident Evil (available for the PS1, and an official remake for the Gamecube, which was released for PC and XBOX360 and PS3, play the remake, its my favorite game out of them all)
2.) Resident Evil 2 (available for Windows and PS1, a remake is in progress and is likely to release in 2017)
3.) Resident Evil 3 (it is a main series entry because of the 3 in the title, but its more or less a prequel to RE2)
4.) Resident Evil Code Veronica (available for the Dreamcast, is actually the real third main game in the series, not being officially recognized because of licensing issues)
5.) Resident Evil 4 (available for PC and almost every console out there)
6.) Resident Evil Revelations (focuses on events between RE4 and 5)
7.) Resident Evil 5 (available for PC and consoles)
8.) Resident Evil Revelations 2 (a bridge between RE5 and RE6)
There are two rail shooter games called RE : Umbrella Chronicles and RE : Darkside Chronicles which follow a separate story, if you want to play those.
Also, there are two animated movies, namely Resident Evil Degeneration and Resident Evil Damnation. Stay away from the Paul Anderson live action movies though.
As for Metal Gear series, i believe this is the correct order of playing the games regarding the storyline:
1.) Metal Gear Solid III Snake Eater
2.) MGS Peace Walker
3.) MGS Ground Zeroes and MGS The Phantom Pain (Ground Zeroes is basically the prologue portion of Phantom Pain)
4.) MGS 2
5.) MGS (PS1 original)
6.) MGS Sons of Liberty
7.) MGS Guns of the Patriots
and finally, Metal Gear Rising Revengeance (pretty over the top name i know, play the PC version, its better)
The events of the original NES game "Metal Gear" occur somewhere between Ground Zeroes and MGS 2 I think.