It's not an exact science but in order to gain weight, you need to eat a mixture of mid to high level glycemic index foods. Translation=CARBS and alot of them!!!
Mid level index Carbs=Oatmeal, Wheat Bread, Pasta, Brown Rice, Bananas, etc, ....
High level=Bagels, White Bread (once in awhile), White Potatoes, White Rice, etc, ...
High level foods are usually overly processed so proceed with caution.
Protein should definitely be inclusive but its function is more for muscle fiber repair as well as Poly
fats found in nuts, fish and plant based oils (olive oil, corn oil, etc, ....).
If someone (trainer or otherwise) tells you hit the gym hard and just eat tons of protein, take a dumbbell and drop it on their big toe. Thats a neanderthal approach.
Then there are genetics. You seem to have an ectomorph build so it's going to be very hard to gain weight unless you take tons of supplements but that's another forum. I'm an ecto and when I started working out my weight was 148lbs. The max I've been able to reach is 172 but I usually stay around 168. And I can still eat everything (junk food included) under the sun and not gain at the ripe old age of 42.