Occasional pacing happens

Some bettas swim along the front glass when they see people or expect food.

Constant pacing is different

Repeated frantic swimming can mean stress from reflections, poor water, too little cover, or unsuitable tank conditions.

Reduce triggers

Add cover, adjust lighting, block reflections if needed, and test the water.