I think I know how to add dashed asymptotes \draw [dashed] (1st pt) -- (2nd pt)
but before I have to remove the default asymptotes. Maybe one way is to truncate the domain in the neighborhoods of the asymptotes in order to have a domain composed of (in this case) 5 smaller sets, but I don't know how to do it. Also maybe there is a simpler solution.
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{geometry}
\geometry{
showframe, % mostra l'area di lavoro
a4paper,top=2cm,bottom=3cm,left=2.5cm,right=3cm,% per regolare i bordi a piacimento
heightrounded,bindingoffset=5mm}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ymin=-6,ymax=6,
xmin=-6,xmax=6,
xtick=\empty,
ytick=\empty,
extra x ticks={-4.71,-3.14,-1.57,0,1.57,3.14,4.71},
extra x tick labels={$-\frac{3\pi}{2}$,$-\pi$,$-\frac{\pi}{2}$,0,$\frac{\pi}{2}$,$\pi$,$\frac{3\pi}{2}$},
axis lines=center,
xlabel={$x$},
ylabel={$y$},
domain=-1.8*pi:1.8*pi, ]
\addplot [samples=200] {tan(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}