I read a few times that DSL modem isexample of CSU/DSU. To my understanding CSU/DSU connect digital communication method to digital while DSL modulate digital communication to analog. If so, how can it be the same device?
CSU/DSU is usually only used to refer to T-carrier lines, dubbed digital signal. T-carrier lines use Alternate Mark Inversion line codes. Basically, there are just two symbols - mark and space - at a high baudrate, requiring high-frequency cables.
xDSL is a family of broadband modulation schemes using discrete multi-tone modulation (DMT) or more specifically orthogonal frequency-division multiplexing. DMT uses a large number of frequency carriers to transport data. The modulation is well suited for low-frequency telephone lines in the local loop.
Re-using local-loop phone cables is much cheaper than deploying dedicated high-frequency cables. Therefore, many providers have adopted using DSL technology for their formerly expensive T-carrier business. Although the base technology has changed the complete product is still referred to with its old name. So, a CSU/DSU installation might technically be using DSL and not DS1.
When you look at a DS1 line and a DSL line on an oscilloscope, the DS1 signal looks digital (two levels) while the DSL signal looks like noise. This is often referred to as digital versus analog signaling. While there is some truth in it on the symbol level, the actual distinction is moot. Both signals are digital from a higher point of view and analog from a lower POV.