The tradition of fasting was forged in personal works to prove to deity your sincere earnestness and thereby hopefully persuade their favor. This is typical of the sin-conscious-driven currency. Their abstinence was praying for their sins and buying favor from their deity.
John’s disciples were under the old covenant and Jesus represented the new covenant.