From what I have read, after eating 21 modaks Ganesha and Shiva felt full, and perhaps that is why 21 modaks are served to Ganesha.