In the UK, it's quite simple: The money that the company makes after paying for goods, salaries etc. is profit. The company pays tax on the profit. The profits after taxes are owned by the company. Even if you own 100% of the company, you can't just take the money.
Instead, the owners of the company can discuss between themselves whether they want to use their profits to pay dividends to the company owners. This may be a very onesided discussion if you are the only owner :-) Then the money gets paid out as a dividend, and everyone receiving a dividend has to pay taxes on it.
The tax office will be unhappy if they find out that you paid out dividends to people who don't seem to deserve any dividends (typically if dividends are paid to a wife who has no other income and therefore pays no taxes, while not contributing anything to the company). If the tax office is unhappy, they try hard to make you unhappy and usually succeed.
The tax office will also be unhappy if you "just take money from the bank account". The company can give you a loan - in which case that needs to be written down, and the loan must be repaid. If you have no intent to pay back the loan, that could be fraud. And for dividend payments, that needs to be written down as well. Even if you are the only one making the decision to pay a dividend, that must be agreed upon and recorded.
BTW. If you pay so much in dividends that you can't pay your taxes or your bills afterwards, that is strictly illegal and you may even go to jail for doing it.
BTW. If you have employees then you pay their salaries and are responsible for sending their taxes to the tax office; these payments will reduce your profits, so this is not really relevant to your question. But if you took so much in dividends that you cannot pay your employees, that would be legal trouble for you.
I would expect other countries to have similar rules.
(Not sure if the question has changed or I missed it, but you are free to pay yourself a different salary every month (and pay income tax on it), depending on how well your business was doing in that month, and end up with zero profit. That's in the UK not the most tax-effective way to do it; paying yourself a dividend is financially better).