Being new to this, am I allowed to call in when hearing a contest? I tx an Italy contact on HF and they asked for my serial number?
Yes, you are always allowed to respond; contests are not given any special consideration in the regulations of amateur radio. And if someone is calling CQ for a contest, then they want all the contacts they can get. However, there are some things you can do to prepare to respond in a way that they will appreciate. Start with looking up the rules of the contest (which you should be able to find on the web).
See which contacts qualify to score points in the contest. For example, if you hear someone calling from Italy, they might be participating in a contest for contacting countries outside of Italy; so they will not gain points for a response from inside Italy. (This is a general principle; I don't know anything about Italy in particular.)
Contests usually have an “exchange”, which is some information to be passed besides the call signs of the participants. In your example, we know that it's a serial number. A serial number is just a number you assign to your contacts in the contest — so if you had responded to the operator you heard, you would give them number 1, and then if you had a contact with someone else after that, you would give them number 2, and so on. This is regardless of what serial number they give you.
It is helpful, but not required, to send logs to the contest organizers after the contest is over, so they can cross-check them with the other participants. Even if you don't care what your own score is, this helps the organizers identify misheard call signs or even falsified logs.
If you don't have information about the contest, or don't want to look it up, that doesn't mean you should necessarily avoid it; amateur radio is about communicating even if you don't have any Internet access and only have the information your radio brings you, after all.
A polite operator should be willing to tell you what they want. Listen to their calls to tell if they've got lots of contacts and are trying to go as fast as possible (hurried responses, no unnecessary words) or if they're looking out for anyone at all that can hear them (repeated calls without a contact, naming a region rather than just “CQ Contest”), and respond if it's more like the latter.