If a holder of a US passport legally enters Canada and obtains a visa, can s/he then walk across the border whenever s/he wants?
The time of day for legal entry is not restricted, but the manner of entry can be (depends on what yuo mean by "whenever s/he wants") Entry into Canada is subject to the requirements of the Immigration and Refugee Protection Act §18ff which says that
(1) Subject to the regulations, every person seeking to enter Canada must appear for an examination to determine whether that person has a right to enter Canada or is or may become authorized to enter and remain in Canada.
Therefore, even Canadian citizens cannot unconditionally walk across the border. A citizen / registered Indian can enter after satisfying an immigration officer of that fact, and the officer is directed to admit them. Permanent residents have that same right. A visa is not necessary for a US citizen for ordinary tourism, therefore one must assume that they obtained a visa allowing temporary residence. Then, under §22
(1) A foreign national becomes a temporary resident if an officer is satisfied that the foreign national has applied for that status, has met the obligations set out in paragraph 20(1)(b), is not inadmissible and is not the subject of a declaration made under subsection 22.1(1).
As with Canadian citizen entry, the right to enter is not completely unimpeded (you can't just hike into Canada), but subject to the proof-of-admissibility requirement, you can enter.
There are special provisions for air and marine entry since you can fly your plane or steer your boat to a place in Canada that doesn't have immigration facilities, in which case you go find an immigration officer and report for inspection – there is no law prohibiting entry outside of specific hours or at specific coordinates. RCMP can intercept those who enter between ports of entry. Pre-covid, one could obtain an advanced permit to enter on the Pacific Crest trail, which constitutes a quasi-exception although you could still be intercepted, but passed through.