How often you train matters, but it is not the only variable that matters. Two people training twice a week can see very different results depending on what they do during those sessions, how they recover, and how consistently they show up over months rather than days.
For most people new to structured exercise, two to three sessions per week is a reasonable starting point. This frequency allows enough stimulus for adaptation while leaving adequate recovery time. As fitness improves and the body adapts, frequency can be adjusted upward if warranted by the program goals.
The most important frequency variable is actually long-term consistency. Training four times a week for six weeks and then stopping is far less productive than training twice a week for six months without interruption.