It actually stems from a time when carrying concealed was something that the culture viewed as more appropriate for assassins and people with something to hide.
While it was felt that an honest man with nothing to hide open carried.
(Government also preferred those who were going to carry do it openly in an easier to manage and recognize way, and restricting open carry worked contrary to that because more would just carry concealed.)
This was a belief stronger in some places than others, so some states restricted concealed carry while others did not.
But Open Carry was generally left alone, that was going too far to regulate at the state level to most, infringing on a man's freedoms.
So assassin carry was restricted and open carry was the right of most men.
Today that traditional view from over 100 years ago is almost reversed, and concealed carry is seen as normal, with some seeing open carry as creating trouble.
(Both types have their merits, and pros and cons the other does not have. Blanket restrictions can also limit changing the way you carry for different environments.)
As far as believing it impacts bad guys, that is not very accurate. Many of the bad guys people associate with the term commit crime on a regular basis. They get caught some of the time and tend to generate a continual criminal record.
They are generally prohibited persons, and carrying openly is letting everyone see they are breaking the law, even if people don't know it.
So it is still illegal for them to carry openly.
It also announces to everyone they are armed, and bad guys generally want the element of surprise, walking around visibly armed just tells everyone else to be ready to deal with an armed person.
It also means any police that know them and know they are trouble will instantly recognize they are breaking the law if they see them walking around with a pistol.
The big trouble makers in an area tend to become familiar to the police who work that same area regularly. Whether it is from seeing them when they respond to loud and suspicious parties, or dealing with them breaking the law. They will learn who they are if they are living the lifestyle of a local macho trouble maker some young men do.
Carrying a gun openly means the police will respond immediately to them in a hostile manner. They may get shot, they may end up on the ground hard, and they will likely be charged.
Criminals prefer illegal concealed carry to open carry. They have the benefits without as much of the risks.
So restrictions on open carry have little impact on how criminals carry their illegal to own firearms on their person.