A pyrene-functional polystyrene copolymer was prepared via 1,3-dipolar cydoaddition reaction (Sharpless-type click recation) between azide-functional styrene copolymer and 1-ethynylpyrene. Subsequently, nanofibers of pyrene-functional polystyrene copolymer were obtained by using electrospinning technique. The nanofibers thus obtained, found to preserve their parent fluorescence nature, confirmed the avoidance of aggregation during fiber formation. The trace detection of trinitrotoluene (TNT) in water with a detection limit of 5 nM was demonstrated, which is much lower than the maximum allowable limit set by the U.S. Environmental Protection Agency. Interestingly, the sensing performance was found to be selective toward TNT in water, even in the presence of higher concentrations of toxic metal pollutants such as Cd2+, Co2+, Cu2+, and Hg2+. The enhanced sensing performance was found to be due to the enlarged contact area and intrinsic nanoporous fiber morphology. Effortlessly, the visual colorimetric sensing performance can be seen by naked eye with a color change in a response time of few seconds. Furthermore, vapor-phase detection of TNT was studied, and the results are discussed herein. In terms of practical application, electrospun nanofibrous web of pyrene-functional polystyrene copolymer has various salient features including flexibility, reproducibility, and ease of use, and visual outputs increase their value and add to their advantage.