Ftp can be accessed by ftp://example.com
but I have seen people accessing ftp using http://ftp.example.com
How can I achieve this kind of functionality? Is there a way I can do this by installing some software?

That somebody has setup a DNS entry calling their machine implies that it provides FTP service. However, I can name my hosts ftp and not run any FTP service, and I can run also run several other services.

It may be the case that any number of DNS host name point to the same machine on the same IP address, or even one machine hosting different IP addresses. The server naming selection is only common convention.