Well, I can't speak to the giant party aspect, but the food aspect at least stems directly from Catholicism. "Mardi Gras" is French for "Fat Tuesday," which is traditionally the day before Ash Wednesday, the beginning of the penitential season of Lent, which lasts until Easter.
During Lent, many penances are taken, and in the early centuries (and later in certain places), no animal products were consumed at all! So there would naturally be a big feast on the last day in which it was legitimate to eat these foods, so as to use them up lest they spoil!
I don't have any data on the rest of it, but it does seem natural to me that a giant feast would turn into a giant party, and might even extend over multiple days in some places.