Demat account generally refers to Dematerialization account. Dematerialization is storing your share certificates in electronic format).  In the good olden days people use to hold share certificates in physical format which has lots of hassels while transfer of shares and maintenance of physical certificates.

And in the new technology era also those physical shares are stored in electronic format by the repositories NSDL and CDSL.  Access to those repositories will be provided by the Depository Participants (Stock Brokers)

So to Invest or Trade in  shares you need to open a demat account with any of the stock brokers (exchange members of NSE,BSE). Your Demat account will be linked with your existing banking account for any transaction and settlement.

All your trading and investing transactions takes place though your Demat account. You need sufficient funding or specified margin to buy shares in share market. You can fund your Demat account with your linked banking account.

You can purchase shares via web based trading platform/ desktop based trading terminal or even place the order via the broker. For investments generally you will receive the shares in your demat account in t+2 days i.e 2 business days from the date of your purchase.