I'm trying to replace a regular single pole light switch with smart light switch and I find the black wire coming from source to the switch but it's not terminating, it goes up to the ceiling. I stopped here because this didn't make sense. Can I get help on what's going on here?
There's more stuff on this circuit
The black wire you see running off to the top of the box is an always-hot that simply powers more things on the circuit, such as receptacles or other lights, while the red wire going up is the switched-hot to the light fixture this switch controls.
Cut and splice the white wire to the neutral from the smart-switch -- you'll have 3 white wires under this nut. Splice both black wires to the always-hot going into the smart switch. Splice the switched-hot from the smart switch to the red wire. Leave any 3-way or traveller terminals on the smart-switch capped-off or taped over.
As to the switch not fitting -- you'll have to finagle a single gang box extender (or a surface raceway starter box) into place and screw it to the box, then screw the switch to the extension. If the extender or starter box is nonmetallic, then you'll have to pigtail the ground on the switch to a ground screw on the back of the box, as well.