5GB is less than the VM running on my laptop has for managing SQL Server.
You have to think about how SQL Server works. Let's just talk about reads for a moment. A read requires access to a page on the disk. Even a one row read is going to go and get an 8k page. That 8k page has to, must, absolutely has to, go into memory before it can be sent to your results on your query. Let's imagine two people running an aggregate against your 500gb data warehouse. Each one is accessing, let's be nice and say, 3gb worth of pages to get the aggregation across a bunch of data. That's 6gb. Even if all 5gb was available for these two queries, and it isn't, you have a whole bunch of other memory caches & requirements that must be met, you're still 1gb shy of being able to move that data through memory for the query. So, it has to page all that out to disk. Yes, it writes out to disk when it doesn't have enough room in memory to gather up a result set. This causes slow downs, additional disk requirements, all sorts of crazy stuff. And we're only talking about two benign queries. What about lots more queries? What about bad queries that are scanning huge amounts of data? What about the need for memory for hash match joins or hash match aggregates? What about the plan cache? I can keep going.
You don't have enough memory on the server.