It’s fine to train throughout the day. Just stick to a minimum of 10 minutes at a time to get your heart rate up.
The CDC recommends you get at least 150 minutes a week of moderate-intensity cardio exercise or 75 minutes at vigorous intensity.
You can get the same fitness perks in half the time with vigorous exercises. Jog, swim laps, cycle fast, or play a sport that involves a lot of running, for example.