In altcoins, why is it that sometimes the volume increases when the price stays relatively stable or even goes gown? Naturally, if the volume of a market increases, then I would interpret that as increasing demand of that market and expect the price to go up. But it seems that this is not always the case.

I've noticed that sometimes, the volume of an altcoin goes up (over the course of several hours) when the price stays relatively stable or even goes down.

The only case where that I think would happen is when rich people/person is manipulating the market.
Volume is simply the amount of trades in a certain period of time. An increase in volume usually correlates with a change in price, however this does not necessarily imply an increase. Your observation mainly as a price increase is likely due to the current bullish market. A high volume can represent a lot of buyers demanding a coin like it can represent a lot of people selling. A sideway market could be seen simply as more people buy and selling thus increasing the volume without increasing the price.