Basically there are two possibilities and my bet is on the first: 1) a runaway process or 2) a bad battery.
To look for a rogue process, open Activity Monitor and select the CPU tab. Then click on the %CPU column so that the list is sorted from highest usage to lowest. If there's a process eating up the battery you'll see a single process (maybe two) that are consistently at the top of the %CPU column running consistently at high numbers. (You can also click on the Energy tab and select the Energy Impact column. I simply always forget this one exist!)
If you don't see a process that is obviously running 'hotter' than others then it is time to check the battery health. Click on the Apple menu and select About this Mac. Then click on the System report button and look in the left column for Power. In the right window look for Battery Health.
BTW - more times than not a rogue process can be fixed by rebooting the computer