Can I use extra wire from two separate cables to add a washing machine in a garage?
You should definitely pull a new cable for the washing machine circuit.

Problems with your solution

You can't use a red wire as a neutral (See NEC 200.6(A)).
Circuit conductors (wires) must be contained in the same &quot;raceway, auxiliary gutter, cable tray, cablebus assembly, trench, cable, or cord&quot; (See NEC 300.3(B)).
You have not clearly described where all the wires in the junction box come from/go to, or what else is on those circuits.  So there's no way to know for sure if it's possible to use them to power the washing machine.
Laundry branch circuits are not allowed to have any other outlets (See NEC 210.11(C)(2)).
Laundry outlets must be GFCI protected (See NEC 210.8(A)(10)).