There are no engraved rules about this, but in my experience (in machine learning) reviewers (unfortunately) usually do not push for source code to be released, nor do journals/conferences AFAIK demand it. While there has been some push for reproducible research, in my experience, these practices are not yet well entrenched.
You do not specify what the goal of your code is, but here are some general tips:
- Simulator used to generate synthetic data: Reviewers are usually satisfied by only having the generated data published and explaining how it was generated (or reference whatever paper was used to implement it).
- Implementation of existing or proposed algorithms that perform calculations necessary for your experiments. Again, make sure the algorithms are well-documents, either in your paper or existing literature. If a reviewer insists on having code published (which is rare), you could publish an MWE (minimal working example) with the part that the reviewer is concerned about. For example, if it is a predicted model, you can share the parameters and inference code (keeping the optimization part closed).
- User interface to help automate some tasks such as data labeling. I doubt reviewers will care about such software unless the paper is specifically about the software.
All that being said, I would make sure to have your supervisor's consent (and whoever contributed to the existing code) before proceeding: is your motivation to eventually monetize from your software? You say that "the source code is so low in quality"; therefore, you had the opportunity to go through the existing code. I am pretty sure your code is now considered derived work. Courts have ruled that even inspecting binary code (called reverse engineering) is considered derived work (see clean room design), so I would expect no less from reproducing existing software after looking at its source code. (But that's the topic of another stackexchange.) Furthermore, since the software is produced as part of your studies and (I guess?) from a publicly funded PhD, you should have a look at whether you will need university or funding agency permission if you commercialize it (see this question about that).
If your goal is not to monetize the software, you should consider if giving back is not to your benefit -- others will use and build upon it, which implies citations, collaborations, networking opportunities and improve your curriculum vitae.
EDIT: As the other reply said, there is confusion in the title of your question. Open-access journals mean that the paper is publicly available (author pays). Closed-access journals mean the paper is behind a pay-wall (reader pays). It is a completely orthogonal topic to your question about source-code.