I'm married to a British citizen.
If I got accepted for a visitor visa to the UK to visit my wife, is there any legal way I could stay and not come back to my country after the visa expired?
No. You cannot switch from a visitor visa into any other category from within the UK. You should apply for a family visa to join your spouse. Any attempt at 'visiting' your wife with the goal of remaining in the country after gaining entry beyond the terms of your visa could be seen as deception and get you a ban.