If I go to UK on visitor visa, am I allowed to marry an EEA national and apply for a residence card?
No, if the purpose of your visit to the UK is explicitly to marry and settle. https://www.gov.uk/standard-visitor-visa
Visitors who have entered the UK as a genuine visitor and subsequently wish to marry or form a civil partnership can give notice https://www.gov.uk/marriages-civil-partnerships/give-notice of their intention to marry at their local register office but the immigration authorities at the Home Office will be told.
The Home Office might:
ask questions about you and your relationship - if this happens you may need to wait up to 70 days before getting married or forming a civil partnership
decide not to approve your notice - if this happens you cannot get married or form a civil partnership in the UK
For a detailed description of the steps required to marry in England and Wales, see https://www.citizensadvice.org.uk/family/living-together-marriage-and-civil-partnership/getting-married/ and for Scotland see https://www.nrscotland.gov.uk/registration/getting-married-in-scotland/how-do-i-go-about-it
For you to get a residence permit in the UK after your marriage, your Italian spouse would need to be exercising his freedom of movement rights to live in the UK. There is a brief overview of what this means during the post-Brexit transition period here https://www.bbc.com/news/uk-49973387