The most obvious reason for the difference is that Spanish, like English, does not have geminate consonants (aside from occasional “fake” geminates that arise from the same consonant occurring on either side of a morpheme or word boundary). Consonants that were geminate in Latin were simplified to singletons in Spanish but not in Italian.
Interestingly, there are some possible arguments for considering Spanish palatal consonants (ñ, ll, y, ch) as abstractly geminate on a "structural" level, presented in "Palatal Phenomena in Spanish Phonology", by Gary Kenneth Baker (2004). Baker states that antepenultimate stress appears to be forbidden in Spanish when the final syllable starts with one of the palatal consonants; similarly, heterosyllabic consonant clusters and the rhotic trill /r/ (sometimes analyzed as underlyingly geminate in Spanish) also attract stress to the penultimate syllable (page 4).
The historical reason for the gemination seen in Italian is the origin of the palatal nasal in the Latin heavy consonant cluster /gn/ or a /nj/ sequence. Both the nasal and palatal gestures were combined, but the length ended up being that of two consonants—approximately, and only in some varieties. As mentioned in the comments, since there is no contrast, duration may vary even in Italian.
Fonosintatic doubling affects a different set of consonants: the Italian always-geminate consonants are geminated after any vowel, whereas fonosintatic doubling occurs only after stressed word-final vowels or certain lexically specified vowel-final function words.