There is a significant need of advanced materials that can be fabricated into functional devices with defined three-dimensional (3D) structures for applications in tissue engineering, flexible electronics, and soft robotics. This need motivates an emerging four-dimensional (4D) printing technology, by which printed 3D structures consisting of active materials can transform their configurations over time in response to stimuli. Despite the ubiquity of the active materials in performing the self-morphing process, their potentials for 4D printing have yet been fully explored. In this paper, we demonstrate the 4D printing of a commercial polymer, SU-8, which has yet been reported in this field. The working principle is based on a self-morphing process of the printed SU-8 structures through spatial control of swelling medium inside the polymer matrix by a modified process. To understand the self-morphing behaviors, fundamental studies on the effect of the geometries including contours and filling patterns were carried out. A soft electronic device as an actuator was demonstrated in order to realize an application of this programmable polymer using 3D printing technology. These studies provide a new paradigm for application of SU-8 in 4D printing, paving a new route to exploration of more potential candidates by this demonstrated strategy.