The date of your visa's expiration has no bearing on whether you can remain in the country, or for how long. See https://travel.state.gov/content/visas/en/general/visa-expiration-date.html.
What matters is the stamp in your passport. If it has an "admit until" date, you must leave by that date. If it says "D/S," duration of status, you can stay as long as you maintain J-1 status. If you "complete" your program successfully, you get a 30-day grace period before you have to leave. Otherwise (if you leave the program early), you have to leave immediately.
Note that the question is asking about a visa that expires "during the program" -- because J-1 status is dependent on your remaining in the program. If the visa expires after the end of the program, the answer to the question is different.
The question you should be asking is not be whether it is legal to stay in the US after the visa expires, but rather
Is it legal to stay in the US after I finish my J-1 program?
And the answer to that question is
Yes, for 30 days only, unless you leave the program early, in which case you must leave the US immediately.
Some J-status nonimmigrants may be eligible to change into another nonimmigrant status without leaving the US. For more information, see https://www.uscis.gov/visit-united-states/change-my-nonimmigrant-status-category/change-my-nonimmigrant-status.
Your real question, though, is how to stay in the US working after your program finishes, so you need to find a nonimmigrant status that will allow you to do that. You also need to find an employer willing to sponsor you. This can be difficult, depending on your qualifications.
As to your girlfriend, she will only be able to come with you if she qualifies independently for a visa. If you want to sponsor her to come with you, you would need to marry her, and even then she would be only eligible to accompany you as a dependent in certain classifications. For example, if you had an H-1B visa, you could bring her as a family member in H-4 status.