This depends entirely on the details of the employment agreement between the employee and the employer. In the US, the default is that work done "in the scope of employment" is work made for hire. That is, work that is part of an employee's regular job assignment belongs to the employer from the start.
But an employment agreement can either broaden or narrow that standard, and will be generally honored. Many employers require agreements that work done during wok hours, or using work resources be assigned to the employer. Some require work in a field where the company has a product, or even all creative work be assigned to the employer.
Some jurisdictions have laws limiting the scope of such laws, but most US stats do not. Since the question does not indicate a country, nor a state or province, there is no way to judge the applicability of any such law.
An employee could ask the company, perhaps through an HR department, what its policy is on such matters.
If an agreement requires creative work to be assigned, and the local law permits such an agreement, then an employee probably has no way to prevent such an agreement from being effective.
Given the conditions stated in the question, only the most sweeping of assignment agreements would apply, and those are the most likely to be regulated by local law.
In US law, there is a subtle but significant difference between work-made-for-hire (WFH) and work assigned by employee to the employer under an agreement. Under US law, the employer is the legal "author" of WFH, and the employee's lifespan is not used in measuring the term of the copyright, neither does the employee have rights to terminate the transfer later. Assigned work lists the employee as author, but transfers the copyright at once to the employer. This distinction does not occur in the laws of most European countries. Indeed in Germany, copyrights may not be owned by a corporation, but only by a natural person, and can only be transferred by inheritance, although they can be licensed to a corporation.
US Copyright Law
Works Made for Hire
17 USC 101 (d) provides that:
A “work made for hire” is—
(1) a work prepared by an employee within the scope of his or her employment; or
(2) a work specially ordered or commissioned for use as ... [list of 9 specific categories of work] ... , if the parties expressly agree in a written instrument signed by them that the work shall be considered a work made for hire.
Since the question specifies that the creator is an employee, part (1) of the definition of WFH applies. And if the creation was not assigned to the employee, was not done during work hours, and is in a field where the company has no products or intents, in could hardly be within he "scope of employment".
If the creator were a contractor, there would have to be an explicit agreement making the work a WFH. If there is not, no WFH. Besides, "software" is not one of the 9 categorizes.
In either case, the project is not WFH
17 USC 201 (d) provides that:
(d) Transfer of Ownership.—
(d) (1) The ownership of a copyright may be transferred in whole or in part by any means of conveyance or by operation of law, and may be bequeathed by will or pass as personal property by the applicable laws of intestate succession.
17 USC 204 (a) provides that:
(a) A transfer of copyright ownership, other than by operation of law, is not valid unless an instrument of conveyance, or a note or memorandum of the transfer, is in writing and signed by the owner of the rights conveyed or such owner’s duly authorized agent.
This means that an assignment agreement, assigning creations of the employee's to the employer, is legal under 17 USC. But there must be a written and signed agreement. If there is no such agreement, and WFH does not apply, no copyright is transferred.
Michigan law explicitly permits non-compete agreements under Section 445.774a This ios not directly relevant, but states which prohibit non-compete contracts often also limit or prohibit IP assignment clauses in employment contracts.
I can find no Michigan law specifically prohibiting or limiting IP assignment agreements (nor any MI law specifically authorizing them.) So they are probably lawful, on the same basis as any othet contract provision.
In Michigan, an employer would gain teh right to employee creations, outside the scope of employment, if and only if there was a specific written and signed agreement giving the employer this right. This would be unusual, but not illegal.
If such an agreement was signed by the employee it would be binding and enforceable.