Capital markets are markets in money. In a capital market investors provide money, with the expectation that they will make a financial gain on the returns.
Not all financial markets are capital markets. Commodities markets involve the exchange of money for commodities. Foreign currency markets are not use to raise money. Neither are all ways of raising money part of capital markets. Borrowing from a bank raises money but does not involve a market process.
Short term borrowing, even through a market, is not generally regarded as taking place on a capital market. So banks borrowing money from each other in overnight money markets is not regarded as raising money in capital markets.
The most important function of capital markets is to allow issuers of securities to raise money from investors, the primary market. This provides a mechanism for funding expansion and new ventures. Capital markets also encourage investors because they have an exit mechanism: when you need the money back from your investment there is a market to sell your investment.